Answer to Question #264754 in Algorithms for lhanz

Question #264754

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.

1
Expert's answer
2021-11-12T00:55:07-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS