Define a Class in C++ with constructor. (TRAVEL PLAN)


Define a class TRAVELPLAN in C++ with the description given below:

Private members
  • ·         PlanCode of type long
  • ·         Place of type character array
  • ·         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_Bues as 1.
  • ·         A function New Plan() 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
Equal to or more than 20 and less than 40
Equal to 40 or more than 40
1
2

3

  • ·         A function ShowPlan() to display the content of all the data member on screen.




No comments

Post your comments

Powered by Blogger.