10. Define a class in C++ with following description:
Private Members :
A data member Flight number 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
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200
Public Members :
A function FEEDINFO() to allow user to enter values for Flight Number, Destination,Distance & call the function CALFUEL() to calculate the quantity of Fuel
A function SHOWINFO() to allow user to view the content of all the data members
11. Define a class batsman with the following specifications:
Private members:
bcode 4 digits, bname 20 characters, innings, notout, runs all of them integer type.
batavg, it is calculated according to the formula batavg =runs/(innings-notout)
calcavg() Function to compute batavg
Public members:
readdata() Function to accept value from bcode, name, innings, notout and invoke the function calcavg()
displaydata() Function to display all the data members on the screen.
12. Define a class Clothing in C++ with the following descriptions :
Private members :
Code of type string, Type of type string, Size of type integer, Material of type string and Price of type float
A function CalcPrice() which calculates and assigns the value of Price as follows :
For the value of Material as “ Cotton “
Type Price (Rs.)
Trouser 1500
Shirt 1200
For material other than Cotton” the above mentioned Price gets reduced by 15%.
Public Members :
A constructor to assign initial values of Code , Type and Material with the word “
NOT ASSIGNED” and Size and Price with 0.
A function Enter() to input the values of the data members Code , Type , Size and Material and invoke the CalcPrice() function.
A function Show() which displays the content of all the data members of Clothing.
Please click on below link to download CBSE Class 12 Computer Science Header Files Worksheet