Write a C++ program for ticket booking system

Ticket Booking System



Write a C++ program for ticket booking system

object: write a C++ program for ticket booking system program will then ask to enter age of person and will run until you enter the age of last family member program will then tell you the amount due after each person’s age you enter
——> the rates for discovery
*children below 10 are not allowed to sit on the discovery
*10-15(age) wins 10 % discount
15-20 wins 5% discount
*while no for above 20
——> the rates for bus swing
* 1-5 (age) wins 50 % discount
* 5-10 25% discount
parking fee which is 10/hour
price of ticket is PKR 100. C++ projects for beginners with source code

Code:

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
       int a,i,age[100];
       double amt[100],sum=0,sum2=0;
       cout<<“\n\t———————————————————\n”;
       cout<<“\t T I C K E T B OO K I N G S Y S T E M\n”;
       cout<<“\t———————————————————\n”;
       cout<<“\nHow many Members in your family?\n”;
       cin>>a;
       cout<<“Enter the Age of Your “<<a<<” Family Members:\n”;
       for(i=0;i<a;i++)
       {
             cin>>age[i];
       }
       cout<<“\n=====================================\n”;
       cout<<“\nThe rates for discovery.\n”;
       for(i=0;i<a;i++)
       {
             if(age[i]>=10 && age[i]<15)
             {
                   cout<<“\n\n10-15(age) wins 10% discount.”;
                   amt[i]=100-(100*10/100);
                   cout<<“\nRates for discovery for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
             else if(age[i]>=15 && age[i]<=20)
             {
                   cout<<“\n\n15-20(age) wins 5% discount.”;
                   amt[i]=100-(100*5/100);
                   cout<<“\nRates for discovery for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
             else if(age[i]>20)
              {
                    cout<<“\n\nAbove 20 Rates is fix.”;
                    amt[i]=100;
                   cout<<“\nRates for discovery for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
             else
             {
                   cout<<“\n\n”<<age[i]<<” years are not allowed because Below 10 Children are not allowed to sit on         discovery\n”;
                   amt[i]=0;
             }
             sum+=amt[i];
       }
       cout<<“\n\n=====================================\n”;
       cout<<“\nTotal Price of Ticket is: “<<sum;
       cout<<“\n\n=====================================\n”;
       cout<<“\nThe rates for bus swing\n”;
       for(i=0;i<a;i++)
       {
             if(age[i]>=1 && age[i]<5)
             {
                   cout<<“\n\n1-5(age) wins 50% discount.”;
                   amt[i]=10-(10*50/100);
                   cout<<“\nRates for bus swing for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
             else if(age[i]>=5 && age[i]<=10)
             {
                   cout<<“\n\n5-10(age) wins 25% discount.”;
                   amt[i]=10-(10*25/100);
                   cout<<“\nRates for bus swing for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
             else
             {
                   cout<<“\n\nAbove 10 Rates is fix.”;
                   amt[i]=10;
                   cout<<“\nRates for bus swing for “<<age[i]<<” years member is: Rs “<<amt[i];
             }
       sum2+=amt[i];
      }
       cout<<“\n\n=====================================\n”;
       cout<<“\nTotal Price of bus swing is: “<<sum2;
       getch();
}

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
	int a,i,age[100];
	double amt[100],sum=0,sum2=0;
	cout<<"\n\t---------------------------------------------------------\n";
	cout<<"\t        T I C K E T    B OO K I N G    S Y S T E M\n";
	cout<<"\t---------------------------------------------------------\n";
	cout<<"\nHow many Members in your family?\n";
	cin>>a;
	cout<<"Enter the Age of Your "<<a<<" Family Members:\n";
	for(i=0;i<a;i++)
	{
		cin>>age[i];
	}
	cout<<"\n=====================================\n";
	cout<<"\nThe rates for discovery.\n";
	for(i=0;i<a;i++)
	{
		if(age[i]>=10 && age[i]<15)
		{
			cout<<"\n\n10-15(age) wins 10% discount.";
			amt[i]=100-(100*10/100);
			cout<<"\nRates for discovery for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		else if(age[i]>=15 && age[i]<=20)
		{
			cout<<"\n\n15-20(age) wins 5% discount.";
			amt[i]=100-(100*5/100);
			cout<<"\nRates for discovery for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		else if(age[i]>20)
		{
			cout<<"\n\nAbove 20 Rates is fix.";
			amt[i]=100;
			cout<<"\nRates for discovery for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		else
		{
			cout<<"\n\n"<<age[i]<<" years are not allowed because Below 10 Children are not allowed to sit on discovery\n";
			amt[i]=0;
		}
		sum+=amt[i];
	}
	cout<<"\n\n=====================================\n";
	cout<<"\nTotal Price of Ticket is: "<<sum;
	cout<<"\n\n=====================================\n";
	cout<<"\nThe rates for bus swing\n";
	for(i=0;i<a;i++)
	{
		if(age[i]>=1 && age[i]<5)
		{
			cout<<"\n\n1-5(age) wins 50% discount.";
			amt[i]=10-(10*50/100);
			cout<<"\nRates for bus swing for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		else if(age[i]>=5 && age[i]<=10)
		{
			cout<<"\n\n5-10(age) wins 25% discount.";
			amt[i]=10-(10*25/100);
			cout<<"\nRates for bus swing for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		else
		{
			cout<<"\n\nAbove 10 Rates is fix.";
			amt[i]=10;
			cout<<"\nRates for bus swing for "<<age[i]<<" years member is: Rs "<<amt[i];
		}
		sum2+=amt[i];
	}
	cout<<"\n\n=====================================\n";
	cout<<"\nTotal Price of bus swing is: "<<sum2;
	getch();
}

Output:

Write a C++ program for ticket booking system

Another Program: Write a Program Snake game in C++

3 thoughts on “Write a C++ program for ticket booking system”

  1. Rochel Sanseverino

    It’s actually a nice and helpful piece of info. I am glad that you shared this useful info with
    us. Please keep us up to date like this. Thank you for sharing.

Leave a Comment

Your email address will not be published. Required fields are marked *