In this example, we create a sprite which asks for you to enter a subject mark and tells you the grade.
Grade ranges are shown below:
A | 76 to 100 |
B | 50 to 75 |
C | 40 to 49 |
D | Fail |
We will be using a variable to store the users input.
Also, we will used some “if” blocks and logical operators to produce the grade.
See the blocks in the project below:
https://scratch.mit.edu/projects/629271195
Exercise
If someone enters an erroneous mark, e.g 1000 , the program dosen’t say anything to the user.
Copy or remix the project and Add blocks to say “you’ve entered an incorrect mark” if the user enters a mark higher than 100 or a mark less than 0.
(Hint: an IF block and an OR logical operator may be useful for solving this problem!)
© 2022 Vedesh Kungebeharry. All rights reserved.