#include<iostream.h>
#include<conio.h>
class Train
{
int number; //Train number
int seat_1; // Total seat in 1st class
int seat_2; // Total seat in 2nd class
int seat_3; // Total seat in 3rd class
public :
Train(int i, int j, int k, int m)
{
int number = i;
int seat_1 = j;
int seat_2 = k;
int seat_3 = m;
}
// access functions
int getnum(void)
{
return number;
}
int getseat_1(void)
{
return seat_1;
}
int getseat_2(void)
{
return seat_2;
}
int getseat_3(void)
{
return seat_3;
}
};
class Reservation : public Train
{
int bkd_1; //Seat researved in 1st class
int bkd_2; //Seat researved in 2nd class
int bkd_3; //Seat researved in 3rd class
public:
Reservation(int i, int j, int k, int m) : Train (i, j, k, m)
{
bkd_1=bkd_2=bkd_3=0;
}
void book(int type, int num);
void cancel(int type, int num);
void disp_status(void);
};
void Reservation :: book(int type, int num)
{
switch(type)
{
case '1' : bkd_1 +=num; //add num to bkd_1
break;
case '2' : bkd_2 +=num; //add num to bkd_2
break;
case '3' : bkd_3 +=num; //add num to bkd_3
break;
default: cout<<"Wrong class\n";
}
}
void Reservation :: cancel(int type, int num)
{
switch(type)
{
case '1' : bkd_1 -=num;
break;
case '2' : bkd_2 -=num;
break;
case '3' : bkd_3 -=num;
break;
default: cout<<"Wrong class\n";
}
}
void Reservation :: disp_status(void)
{
cout<<"\t\tTrain Number:"<<getnum()<<"\n";
cout<<"Class\tTotal seats\tReserved\tUnreserved\n";
int val;
val=getseat_1();
cout<<"1\t"<<val<<"\t"<<bkd_1<<"\t"<<val-bkd_1<<"\n";
val=getseat_2();
cout<<"2\t"<<val<<"\t"<<bkd_2<<"\t"<<val-bkd_2<<"\n";
val=getseat_3();
cout<<"3\t"<<val<<"\t"<<bkd_3<<"\t"<<val-bkd_3<<"\n";
}
int main()
{
clrscr();
int num;
cout<<"Enter Train number:\n";
cin>>num;
cout<<"\nEnter total number of seats in 1st class\n";
int s1;
cin>>s1;
cout<<"\nEnter total number of seats in 2nd class\n";
int s2;
cin>>s2;
cout<<"\nEnter total number of seats in 3rd class\n";
int s3;
cin>>s3;
Reservation Tr(num,s1, s2, s3);
char cl_type;
int choice, seats;
do
{
cout<<"\nMain Menu\n";
cout<<"1. Reservation \n";
cout<<"2. Cancellation \n";
cout<<"3. Display status \n";
cout<<"4. Exit\n";
cout<<"Enter your choice :";
cin>>choice;
cout<<"\n";
switch(choice)
{
case 1 : cout<<"Which class? (1/2/3):";
cin>>cl_type;
cout<<"\nHow many seats?";
cin>>seats;
cout<<"\n";
Tr.book(cl_type, seats);
break;
case 2 : cout<<"Which class? (1/2/3):";
cin>>cl_type;
cout<<"\nHow many seats?";
cin>>seats;
cout<<"\n";
Tr.cancel(cl_type, seats);
break;
case 3 : Tr.disp_status();
break;
case 4 : break;
default : cout<<"Wrong choice!!\n";
}; // end of switch
}while(choice>=1 && choice <=3);
getch();
return 0;
}// end of main()
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

A railway reservation counter needs to computerize its reservation process. Using the following information write C++ Program to do so.

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Program to enter the information of an employee and then display it using the single inheritance concept (one base class and one derived class).
2 Program to enter the information of a student and then display it using the single inheritance concept.
3 Program to enter the information of x number of student and display it using the multilevel inheritance concept.
4 Program using multilevel inheritance to get the data from two base classes and display it using the derived class.
5 Program to demonstrate the use of nested classes taking example of train information.
6 Write a C++ program to read and display information about employees and managers. Employee is the base class and Manager is the sub class.
7 The following incomplete program takes information about students and their marks and their displays their result. Complete it by filling up their blanks (Grade is ‘A’ for percentage>=60.00, ‘B’ for 50-55.99 ‘C’ for 40-49.99 and ‘D’ for<40).
8 A railway reservation counter needs to computerize its reservation process. Using the following information write C++ Program to do so.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement