Computer Science, asked by ivanbhargava, 4 months ago

Define a class TravelPlan with the following descriptions: 5
Private members:
PlanCode of type long
Place String
Number_of_travellers of type integer
Number_of_buses of type integer
Public Members:
A constructor to assign initial values of PlanCode as 1001, Place as “Agra”,
Number_of_travellers as 5, Number_of_buses as 1.
A function NewPlan() which allows user to enter PlanCode,Place and Number_of_travellers.


Also,assign the value of Number_of_buses as per the following conditions:

Number_of_travellers Number_of_buses

Less than 20 1
Equal to or more than 20 and less than 40 2
Equal to 40 or more than 40 3

A function ShowPlan() to display the content of all the data members on screen
pls help asap

Answers

Answered by BrainlyQueen07
0

Answer:

class Travel Plan long PlanCode; char *Place; int Number_of_travellers; int Number_of_buses; public: TravelPlan() { PlanCode=1001; strcpy(Place,"Agra"); Number_of_travellers=5; Number_of_buses=1; } void NewPlan() { cout<<"Enter Travel code, Place and Number of travellers \n"; cin>>PlanCode; gets(Place); cin>>Number_of_travellers; if(Number_of_travellers<20) Number_of_buses=1; else if(Number_of_travellers<40) Number_of_buses=2; else Number_of_buses=3; } void ShowPlan() { cout<<"Plan Code:"<

Similar questions
Math, 4 months ago