Define a Class in C++. (TOUR)


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

Data members
  • CNo to store cab No
  • CType to store a character ‘A’, ‘B’, or ‘C’ as City type
  • Per KM to store per kilometer charges
  • Distance to store distance travelled (in KM)
Member functions
  • A constructor function to initialise  CType as ‘A’ and CNo as ‘0000’
  • A function CityCharges() to assign PerKM as per the following table:


CType
PerKM
A
20
B
18
C
15
  • A function RegisterCab() to allow administrator to  enter the values for CNo and CType. Also, this function should call CityCharges() to assign PerKM Charges.

 

No comments

Post your comments

Powered by Blogger.