Question #278501

A ticket booking system program that will ask to enter age of person and will run until user enter the age of last family member. This program will then notify the amount due after each person’s age entered.


The rates for discovery.

  1. Children below 10 are not allowed to sit on the discovery.
  2. 10-15(age) wins 10 % discount AND 15-20 wins 5% discount.
  3. While no for above 20.


The rates for bus swing


  1. 1-5 (age) wins 50 % discount
  2. 5-10 (age) 25% discount
  3. Parking fee which is RM 10/hour
  4. Price of ticket is RM 100.00. 


Construct the necessary script to solve the given problem.




Expert's answer

#include <iostream>


using namespace std;


int main()
{
    int age, price;
    string name;
    cin >> name >> price >> age;


    if (age > 10 && age <= 15)
        price -= price * 10 / 100;
    else if (age < 10)
        cout << "No sits\n";


    // For bus


    if (age >= 1 && age < 5)
        price -= price * 50 / 100;
    else if (age > 5 && age < 10)
        price -= price * 25 / 100;


    cout << price;
}

LATEST TUTORIALS
APPROVED BY CLIENTS