Presentation is loading. Please wait.

Presentation is loading. Please wait.

Program Design Using Haggis 1 Haggis is a standardised design notation used by the SQA in place of a programming language for the purpose of asking coding.

Similar presentations


Presentation on theme: "Program Design Using Haggis 1 Haggis is a standardised design notation used by the SQA in place of a programming language for the purpose of asking coding."— Presentation transcript:

1 Program Design Using Haggis 1 Haggis is a standardised design notation used by the SQA in place of a programming language for the purpose of asking coding questions in assessments or exams.

2 1. Keywords are always written in upper case letters. SET SEND RECEIVE 2. Each line begins with the word “Line” (Note the capital L) and a single space before the number. Line 1 Line 2 3.Variable names should be written in lower case letters to distinguish from keywords. Where the user wishes to use a longer variable name the second word should begin with a capital letter. e.g. firstName, secondNumber 4. Square brackets should be used in the SEND command. 5. The lines of coding inside a construct should be indented. Line 1 REPEAT Line 2 SEND [“Please enter a number”] TO DISPLAY Line 3 RECEIVE number FROM KEYBOARD Line 4 UNTIL number = Haggis formatting rules.

3 3 PRINT command True Basic PRINT “Please enter your name” HaggisSEND [“Please enter your name”] TO DISPLAY LET command True BasicLET area = length * breadth HaggisSET area TO length* breadth INPUT command True BasicINPUT name$ HaggisRECEIVE name FROM KEYBOARD

4 4 PRINT “ Please enter the height of the triangle ” INPUT height PRINT “ Please enter the base of the triangle ” INPUT base LET area = (height*base)/ 2 PRINT “ The area of the triangle is “ ; area END Line 1SEND [“Please enter the height of the triangle”] TO DISPLAY Line 2RECEIVE height FROM KEYBOARD Line 3SEND [“Please enter the base of the triangle”] TO DISPLAY Line 4RECEIVE base FROM KEYBOARD Line 5SET area TO (height*base)/2 Line 6SEND [“The area of the triangle is ”, area] TO DISPLAY True Basic Haggis

5 5 True Basic IF user_answer$ = correct_answer$ THEN PRINT “Well done! You are correct.” END IF Haggis IF userAnswer = correctAnswer THEN SEND [“Well done! You are correct.”] TO DISPLAY END IF

6 6 LET correct_answer$=”Edinburgh” PRINT “What is the capital of Scotland?” INPUT user_answer$ IF user_answer$ = correct_answer$ THEN PRINT “Well done, you are correct.” END IF END Line 1SET correctAnswer TO “Edinburgh” Line 2SEND [“What is the capital of Scotland?”] TO DISPLAY Line 3RECEIVE userAnswer FROM KEYBOARD Line 4IF userAnswer = correctAnswer THEN Line 5 SEND [“Well done, you are correct.”] TO DISPLAY Line 6END IF True Basic Haggis

7 7 Now attempt questions 1, 2 and 3 from your Questions booklet.

8 8 True Basic FOR counter = 1 TO 10 PRINT firstname$ NEXT counter FOR..... NEXT loop HaggisThere are 2 ways of writing a FOR loop (Version 1) Line 1 REPEAT 10 TIMES Line 2 SEND [firstName] TO DISPLAY Line 3 END REPEAT (Version 2) Line 1 FOR counter FROM 1 TO 10 Line 2 SEND [firstName] TO DISPLAY Line 3 END FOR

9 9 True Basic Haggis PRINT “Please enter your sentence” INPUT sentence$ FOR counter = 1 to 15 PRINT sentence$ NEXT counter Line 1 SEND [“Please enter your sentence”] TO DISPLAY Line 2 RECEIVE sentence FROM KEYBOARD Line 3 REPEAT 15 TIMES Line 4 SEND sentence TO DISPLAY Line 5 END REPEAT

10 10 Now attempt question 4 from your Questions booklet.

11 11 True Basic DO PRINT “Please enter your mark” INPUT mark LOOP UNTIL mark >= 50 DO... LOOP UNTIL Haggis Line 1 REPEAT Line 2 SEND [“Please enter your mark”] TO DISPLAY Line 3 RECEIVE mark FROM KEYBOARD Line 4 UNTIL mark >= 50

12 12 True Basic Haggis DO PRINT “Please enter password” INPUT password$ LOOP UNTIL password$ = “apple” PRINT “You have clearance” Line 1 REPEAT Line 2 SEND [“Please enter password”] TO DISPLAY Line 3 RECEIVE password FROM KEYBOARD Line 4 UNTIL password=”apple” Line 5 SEND [“You have clearance”] TO DISPLAY

13 13 Now read Example 5 in your notes booklet and then attempt Questions 5, 6, 7 and 8 from your Questions booklet.


Download ppt "Program Design Using Haggis 1 Haggis is a standardised design notation used by the SQA in place of a programming language for the purpose of asking coding."

Similar presentations


Ads by Google