Question: Train Ticket for one person. Write a program that reads a persons age, then computes and displays the price the person needs to pay for

Train Ticket for one person. Write a program that reads a persons age, then computes and displays the price the person needs to pay for the train ride according to the following rules:

  • Children younger than 6 years old ride for free.
  • If the ticket is bought at the train station:
    • A person over 70 years old pays $5.20
    • Everyone else pays $11.50.
  • If ticket is bought inside the train, there is an extra charge of 15% compared to train station prices.

Note that a persons age is within the range of 0 to 120 years. Other inputs are considered error conditions.

Part A -

- determine the inputs, outputs and error conditions for the problem.

- write your algorithm using pseudocode, If you detect an error condition, end your program.

- list a thorough set of test cases for your program. Write in the following format [inputs], where the inputs are separated by commas. [inputs][output]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!