Coders Packet

Ticket booking fare estimation system for bus using C++

By Sreekar Reddy Boyapally

This project aims to calculate the total fare for booking seats in a bus by one or more person(s).

Using this project, we can estimate the total cost for booking bus tickets for N number of people.
Initially the main() function take the input for the number of passengers to be considered and store it in an integer pn. According to the number of passengers count entered, it asks for the age of all the passengers and saves them in an integer array named age[]. It can calculate the discount and notify us if there is an age limit for bus travel.

The main() function calls the fare() function wherein it passes the count of passengers(pn) and the array of ages of passengers. Then the fare() function calculates the total fare for the people according to the discounts available for their age limit.

*Kids less than two years are not allowed to travel by bus*.

Discounts on bus seat fare for age groups are as below:
1. 2y - 15y: 10%
2. 15y - 25y:5%
3. 25y - 60y:0%
4. 60y and above:5%

Discounts on bus maintenance fare for age groups are as below:

1. 3y - 5y: 75%
2. 5y - 10y:50%
3. 10y and above:0%

The final output of the project would be the total fare for all the eligible passengers.




Download Complete Code


No comments yet