An applicant will be accepted to the Jedi Knight Academy if he is at least 200 cm
tall; age is between 21 and 25 inclusive, and a citizen of the Planet Endor.
However, if the applicant is recommendee of Jedi Master Obi Wan, he is accepted
automatically regardless of his height, age and citizenship. Write a program that
would input the applicant's height, age, citizenship code (1- citizen 0-not citizen)
and recommendee's code (1- recommended 0- not recommended) and then output
whether the applicant is accepted or rejected.
Start
Declare variable height
Declare variable age
Declare variable citizen
Declare variable recommended
Read height
Read age
Read citizenship code ('C' for citizen of Endor, 'N' for non-citizen)
Read recommendee code ('R' for recommendee, 'N' for non-recommendee)
if recommended = "R" or (height >= 200 and age >= 21 and age <= 25 and citizen="C") then
Display message: "Accepted"
else
Display message: "Rejected"
End if
Stop
Comments
Leave a comment