Define a Class in C++ with constructor. (TOUR)


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

Private members
  • ·         TCode of type string
  • ·         No_of_Adults of type integer
  • ·         No_of_Kids of type integer
  • ·         Kilometers of type integer
  • ·         TotalFare of type float
Public members
  • ·         A constructor to assign initial values as follows:

           TCode with the word “NULL”
           No_of_Adults 0
           No_of_Kids as 0
           Kilometers as 0
           TotalFare as 0
  • A function AssignFare() which calculates and assigns the value of the data member TotalFare as follows:


TotalFare
Kilometers
500
>=1000
300
<1000&>=500
200
<500

  • For each Kid, the above Fare will be 50% of the Fare mentioned in the above table.
  • A function EnterTour() to input the values of the data members T_Code, No_of_Kids and Kilometers and invoke the AssignFare() function.
  • A function ShowTour() which displays the content of all the data members for a Tour.



No comments

Post your comments

Powered by Blogger.