Define a class with constructor in C++. (CABS)
Define a class CABS in C++ with
the following specification:
Data members
- · CNo to store Cab Number
- · Type to store a character ‘A’, ‘B’ or ‘C’ as City Type
- · PKM to store per Kilometer charges
- · Dist store Distance travelled (in KM)
Member functions
- · A constructor function to initialise Type as ‘A’ and CNo as ‘1111’
- · A function Charges() to assign PKM as per the following table:
Type
|
Fare
|
‘A’
|
25
|
‘B’
|
20
|
‘C’
|
15
|
- · A function Register() to allow administrator to enter the values for CNo and Type. Also, this function should call Charges() to adding PKM charges.
- · A function ShowCab() to allow user to enter the value of Distance (as Amount) on screen.
No comments
Post your comments