Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Assignment Classes

Assignment Classes

Ratings: (0)|Views: 57 |Likes:
Published by chandni1972

More info:

Published by: chandni1972 on Apr 18, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/24/2012

pdf

text

original

 
Maharaja Agrasen model School, Pitam Pura,Delhi.Revision Assignment – Classes And Objects
1.
Define a class
 Flight 
in C++ with the following specification:Private Members:
A Data Member Flight Number of type integer 
A Data Member Destination of type String
A Data Member Distance of Float Type
A Data Member Fuel of type floatA Member Function CalFuel( ) to calculate the value of fuel as per the following criteria:Distance Fuel<=1000 500more than 1000 and <=2000 1100more than 2000 2200
Public Members:
A function Feed_Info( ) to allow user to enter values for Flight Number, Destination,Distance & Call Function CalFuel( ) to calculate the quantity of fuel.A Function Show_Fuel( ) to allow user to view the content of all the data members.
2.
Define a class
TEST
with the following specification:Private membersTestcode of type integer Description of type string NoCandidate of type integer A member function
CALCNTR( )
to calculate and return the number of centers as ( NoCandidate / 100 + 1)Public membersA constructor function to initialize Testcode as 12.A function IN_DATA( ) to accept values for Testcode, Description, NoCandidateAnd call function CALCNTR( ).A function OUT_DATA( ) to display all the data members.3. Define a class REPORT with the following specificationPrivate:Adno 4 digit admission number  Name 20 charactersMarks an array of floating point valuesAverge average marks obtainedGetavg( ) to compute the average obtained in five subjectsPublic:Readinfo( ) function to accept values for adno, name, marks andInvoke the function Getavg( )Displayinfo( ) function to display all data members on the screen.4.Define a class 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 floatA member function
CALFUEL( )
to calculate the value of Fuel as per the following criteria :
Distance Fuel
<=1500 250more than 1500 and <=3000 1000more than 3000 2500

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->