98.3k views
3 votes
A driving school uses this rule to estimate how many lessons a learner will require.

- Every learner requires at least 20 lessons

- learners over the age of 18 require more lessons (two additional lessons for each year over 18)

Create an algorithm expressed in pseudo-code that inputs a learner's age and calculates the number of driving lessons they will need.


So far, this is what I've come up with:

RECEIVE age FROM KEYBOARD

SET lessons TO 20 + (2 * (age – 18))

IF age >= 18 THEN

SEND lessons TO DISPLAY

ELSE

SEND ‘You’re not old enough. Come back later.’ TO DISPLAY

END IF


but I'm not sure if I've done it correctly or used the operators correctly.

1 Answer

2 votes

Answer:

This is correct. And to remove the confusion, I am adding the meaning of the Pseudocode. You need to begin with the algo that you are working upon, and then you need it to phrase the algo with the words which are easy to be transcribed in the form of the computer instructions. Now you need to indent the instructions properly inside the loop or within the conditional clauses. And while doing this, you need to not use the words which are used in certain forms of computer language. However, IF and THEN and ELSE and ENDIF are very frequently used as pseudo-code. Hence, your answer is correct.

Step-by-step explanation:

Please check the answer section.

User Aaronsw
by
4.7k points