Topic Wise Solved Problems Question – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
CPP: Topicwise Exam Question: defining-classes siteicon
02C 4
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
CBSE12D-2017

02C-2016 4
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
CBSE12D-2016

02C 4

Write the definition of a class PlC in C++ with following description:
Private Members

Pno       //Data member for Picture Number (an integer)
Category  //Data member for Picture Category (a string)
Location  //Data member for Exhibition Location (a string)
FixLocation  //A member function to assign
             //Exhibition Location as per category
             //as shown in the following table
Category Location
Classic Amina
Modern Jim Plaq
Antique Ustad Khan
Public Members
Enter()     //A function to allow user to enter values
            //Pno, category and call FixLocation() function
SeeAll()    //A function to display all the data members
CBSE12D-2015

Writing Class Definition 4

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

Type Formula to calculate Volume
Type 1 – 3.14*Radius*Height
Type 2 – 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

CBSE12A-2018

02C 4

Write the definition of a class BOX in C++ with 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

CBSE12A-2017

Defining Class Based on Data Members and Functions Given 4

Write the definition of a class CITY in C++ with following description:

Private Members

Ccode         //Data member for City Code (an integer)
CName      //Data member for City Name (a string)
Pop              //Data member for Population (a long int)
KM              //Data member for Area Coverage (a float)
Density      //Data member for Population Density (a float)
DenCal()   //A member function to calculate Density as Pop/KM

Public Members
Record()   //A function to allow user to enter values of Acode,Name,Pop,KM and call DenCal() function
View() //A function to display all the data members. Also display a message ”Highly Populated City”
if the Density is more than 10000

CBSE12A-2016

02C-2015 4

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
CBSE12A-2015