Define a Class in C++. (TRAIN)

Define a class TRAIN in C++ with the following description:
  • ·         A data member TrainNumber of type integer.
  • ·         A data member Destination of type string.
  • ·         A data member Distance of type float.
  • ·         A data member Fuel of type float.
  • ·         A member function CALFUEL() to calculate the value of Fuel as per the following criteria:

Distance
Fuel
<= 1500
250
more than 1500 and <= 1000
1000
more than 2500 
2500

Public Members
  • ·         A function FEEDINFO() to allow user to enter values for the TrainNumber, Destination, Distance and call function CALFUEL() to calculate the quantity of Fuel.
  • ·         A function SHOWINFO() to allow user to view the content of all the data members.





No comments

Post your comments

Powered by Blogger.