Answer to Question #246742 in Algorithms for Jeigh

Question #246742

Passenger fare is classified according to the type of passenger. Senior Citizen enjoys 20% discount from the regular fare, Students get 10% discount. Regular passengers who do not qualified as neither Senior Citizen nor a Student should pay the regular fare of 100. Write an algorithm that will accept details of five (5) passengers, including its name and passenger type and will compute for the corresponding fare of each passenger. Display the name and type of passenger, as well as the computed fare.


1
Expert's answer
2021-10-05T02:32:40-0400
Start
  Declare variables passengername,type,discount,fare
  for p=1 to 5
      Read the passenger name 
      Read the passenger type 
      if passenger type=Senior Citizen then
           discount=0.2
           fare=100*discount
      else if passenger type=Student  then
           discount=0.1
           fare=100*discount
      else
           fare=100
      end if
      Display the passenger's name 
      Display the passenger's type 
      Display the passenger's fare
  end for
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