Login


Lost your password?

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


Shop
CPP All : Defining Classes
Concept Notes and Resources


Exam Papers Problems

Writing Class Definition #5261

( As In Exam - CBSE12A-2018 )

Write the definition of a class CONTAINER in C++ with the following descripti

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

Defining Class Based on Data Members and Functions Given #5634

( As In Exam - CBSE12A-2016 )

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

<

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

02C #5759

( As In Exam - CBSE12A-2017 )

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

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

02C #5863

( As In Exam - CBSE12D-2015 )

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

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

02C-2015 #5947

( As In Exam - CBSE12A-2015 )

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

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

02C #6027

( As In Exam - CBSE12D-2017 )

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

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

02C-2016 #6160

( As In Exam - CBSE12D-2016 )

Write the definition of a class METROPOLIS in C++ with following descriptio

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
Solved Problems

Code error in class #5179

Find error (if any) in the following class definition.

Class PLAY
{

Find error (if any) in the following class definition.

Class PLAY
{
  int number_of_actors=5;
  void set_actor_count()
  {
    number_of_actors=10;
  }
};

Concept Notes:1  Exam Paper Problems:7  Solved Problems:1 
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back