Answer to Question #208538 in C++ for Ahmed Ali

Question #208538

Write a program to book movie tickets online.

Use File Handling and inheritance concept, and other c++ logics.


The Output should include:

1)Available Movies


2)book ticket

(select movie, select time, pay and get seat number)


3)Cancel ticket

(enter seat number to cancel)


4)Show record


5)Exit


1
Expert's answer
2021-06-19T07:00:21-0400
#include<iostream>
#include<stdio.h>


using namespace std;
class Movies
{
    string avb; int tm;int pay;int seat;
    public:
        void Available(){
            cout<<"\nEnter the name of Available movies: ";
            cin>>avb;
        }
        void bookTicket()
        {//select movie, select time, pay and get seat number
                cout<<"\n select movie: ";
                cin>>avb;
                cout<<"\n enter time ";
                cin>>tm;
                cout<<"\nenter pay  ";
                cin>>pay;
                cout<<"\n enter seat number ";
                cin>>seat;
        }
        void CancelTic()
        {
            cout<<"\n enter seat number ";
            cin>>seat;     
        }
         void showRecs()
        {
            cout<<"\n Available movies"<<avb;
        }
        
};


int main()
{       
    Movies m;
        int ch;
        do
        {
                cout<<"\n1. Available";
                cout<<"\n2. Book ticket";
                cout<<"\n3. Cancel ticket";
                cout<<"\n4. Show records\n";
                cout<<"\n5. Exit\n";
                cout<<"\nEnter the choice :: ";
                cin>>ch;
                switch (ch)
                {
        case 1:
                        m.Available();
                        break;


        case 2:
                        m.bookTicket();
                        break;


        case 3:
                        m.CancelTic();
                        break;
                
        case 4:
                        m.showRecs();
                        break;
                
        case 5:
                        break;
                }
        } while (ch!=5);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS