Algorithm Challenge: Bus Tickets

bus-ticket-algorithm

Create an algorithm for the computer, which asks the user for age and returns the price that the user needs to pay for the bus ticket.

  • – The children under age 14 need to pay 50 cents
  • – Adults need to pay $2.

Hints:  

  1. Remember the input command we used in the last post, Sleep Cycle, we have to use it to ask the user for their age.
  2. Use “if and else” statement to differentiate between children and adults in this format: 
    1. If the individual is 14 years and under, they pay $0.50
    2. Else (if they’re older than 14), they pay $2.50

This content is for Ottiya Subscribers.
Log In Subscribe Now