classes_list

CLASSES 


LIST OF CLASSES PROGRAMS 


1. Write  the  definition  of  a  class  CONTAINER  in  C++  with  the following description
Private Members :
 Radius, Height  float
 Type                 int (1 for Cone,2 for Cylinder)
 Volume             float
 CalVolume()      Member function to calculate volume as per the
Type               TypeFormula to calculate Volume
1                    3.14*Radius*Height
2                    3.14*Radius*Height/3
Public Members
GetValues()   A function to allow user to enter value of Radius, Height and Type. Also, call function CalVolume() from it
ShowAll()      A function to display Radius, Height, Type and Volume of Container 

2.   Definition of a class FIGURE in C++ with following description:
Private Members
 Sides   integer
 Shape  char array of size 20
 AssignShape()  Member function to assign value of Shape based upon Sides as follows:
Sides        Shape

<3        Open
=3        Triangle
=4        Quadrilateral
>5        Polygon
Public Members
GetFigure()       A function to allow user to enter value of Sides. Also, this function should call Assign () to assign value of  Shape
ShowFigure()    A function to display Sides and Shape

3.Write the definition of a class RING in C++ with following description :
Private Members
        RingNumber    data member of integer type
        Radius             data member of float type
        Area                data member of float type
       CalcArea()    Member function to calculate and assign Area as 3.14 *Radius*Radius
Public Members
GetArea()    A function to allow user to enter values of RingNumber and Radius. Also, this function  should call CalcArea() to calculate Area
ShowArea() A function to display RingNumber, Radius and Area  
                  

4. Write  the  definition  of  a  class  BOX  in  C++  with  the  following description

Private Members
 BoxNumber   data member of integer type
 Side             data member of float type
 Area             data member of float type
 ExecArea()   Member function to calculate and assign Area as Side * Side
Public Members
 GetBox()   A function to allow user to enter values of BoxNumber and Side. Also, this function should call ExecArea() to calculate  Area
ShowBox() A function to display BoxNumber, Side and Area
 

5.   Write the definition of a class METROPOLIS in C++ with following description :
Private Members
  MCode      Data member for Code (an integer)
  MName     Data member for Name (a string)
  MPop        Data member for Population (a long int)
  Area          Data member for Area Coverage (a float)
  PopDens   Data member for Population Density ( a float)
  CalDen()    A member function to calculate ------- Density as PopDens/Area
        Public Members
  Enter()         A function to allow user to enter values of Mcode,MName,MPop,Area and call CalDen() function
  ViewALL()    A function to display all the data members also display a message “Highly Populated Area”if the Density is more than 12000 

6.    Write  the  definition  of  a  class  Photo  in  C++  with  following description :
   Private Members
 Pno              Data member for Photo Number (an integer)
 Category       Data member for Photo Category (a string)
 Exhibit          Data member for Exhibition Gallery (a string) 
 FixExhibit      A member function to assign Exhibition Gallery as per Category as shown in the following table
   Category        Exhibit
    Antique        Zaveri
    Modern        Johnsen
    Classic        Terenida
   Public Members
Register()    A function to allow user to enter values Pno, Category and call FixExhibit() function
ViewAll()     A function to display all the data members

7.   Define a class Tourist in C++ with the following specification :
Data Members
CNo      to store Cab No
CType      to store a character 'A', 'B', or 'C' as City Type
PerKM     to store per Kilo Meter charges 
Distance  to store Distance travelled (in KM)
Member Functions
A constructor function to initialize 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.

A  function Display()  to  allow  user  to  enter  the  value  of Distance  and  display  CNo,  CType,  PerKM,  PerKM*Distance (as Amount) on screen. 


8.  Define a class TEST in C++ with following description:     
Private Members
 TestCode        of type integer
 Description     of type string
 NoCandidate  of type integer
 CenterReqd (number of centers required) of type integer
   A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1) 
Public Members
A function SCHEDULE() to allow user to enter values for TestCode,Description, NoCandidate & call function CALCNTR() to calculate the number of Centres

A function DISPTEST() to allow user to view the content of all the data members 

9.   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 function CALFUEL() to calculate the quantity of Fuel
A function SHOWINFO() to allow user to view the content of all the data members  


10.   Define a class Tour in C++ with the description given below :

Private Members :
TCode           of type string
NoofAdults    of type integer
NoofKids       of type integer
Kilometres    of type integer
TotalFare      of type float
Public Members :
A constructor to assign initial values as follows :
TCode with the word “NULL”
NoofAdults as 0
NoofKids as 0
Kilometres as 0
TotalFare as 0

A function AssignFare ( ) which calculates and assigns the value of the data member TotalFare as follows For
each Adult
Fare(Rs) For Kilometres
500          >=1000
300        <1000 and >=500
200        <500

For each Kid  the  above  Fare  will  be  50%  of  the  Fare  mentioned  in the above table
For example :
If Kilometres is 850, NoofAdults = 2 and NoofKids = 3
Then TotalFare should be calculated as
NumofAdults * 300 + NoofKids * 150
i.e.
2*300 + 3*150=1050

A  function  EnterTour(  )  to  input  the  values  of  the  data  members TCode, NoofAdults, NoofKids and Kilometres; and invoke the Assign Fare( ) function.
A  function  ShowTour(  )  which  displays  the  content  of  all  the  data members for a Tour
 

11.   Define a class RESORT in C++ with the following description :                      
Private Members :
Rno         Data member to store Room No
Name      Data member t store customer name
Charges  Data member to store per day charges
Days       Data member to store number of days of stay
COMPUTE()       A function to calculate and return Amount as Days*Chagres and if the value of Days*Charges is more than 11000 then as 1.02*Days*Charges
Public Members :
Getinfo()     A function to enter the content Rno, Name, Charges and Days
Dispinfo()    A function to display Rno, Name, Charges, Days and Amount (Amount to displayed by calling function COMPUTE( ))  

Followers

Popular Posts

Recent Posts