Вы находитесь на странице: 1из 6

A.E.C.

Excellence in Computer Education


Q1) Define a class Television in C++ with following description :
Private Members
a. Model_No of type String
b. Manufacturer of type String
c. Cost of type integer
d. Sold (number of televisions sold) of type integer
e. Sale_Amt of type double
f. A member function Calculate( ) to calculate and return the total amount of Sales
(Sold * Cost)
Public Members
a. A function Input( ) to allow user to enter values for Model_No, Manufacturer,
Cost and Sold. And call function Calculate( ) to assign the Sale_Amt.
b. A function display( ) to allow user to view the content of all data members.

Q2) Define a class Hotel in C++ with the following description :


Private Members
a. Rno // Data member to store Room no
b. Name // Data member to store Customer name
c. Tariff // Data member to store per day charges
d. NOD // Data member to store number of days of stay
e. CALC() // A function to calculate and return Amount as NOD * Tariff and if the
value of NOD * Tariff is more than 10000 then as 1.05 * NOD * Tariff
Public Members
a. Checkin () // A function to enter the Rno, Name, Tariff and NOD
b. Checkout() // A function to display Rno, name, Tariff, NOD, and Amount (
CALC() should be called to show amount)

Q3) Define a class Outfit in C++ with the following descriptions:


Private Members
OCode of type String
OType of type string
OSize of type integer
OFabric of type string
OPrice of type float
A function InitPrice() which calculates and assigns the value of OPrice as follows :
For the value of OFabric as “DENIM”
OType OPrice
TROUSER 1500
JACKET 2500
For OFabric other than “DENIM” the above mentioned OPrice gets reduced by 25%.
Public Members
A constructor to assign initial values of OCode, OType and OFabric with the word “NOT
INITIALISED” and OSize and OPrice with 0.
A function Input() to input the values of the data members OCode, OType. OSize and
OFabric and invoke the InitPrice() function.
A function Display() which displays the content of all the data members for an Outfit.

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in


A.E.C.
Excellence in Computer Education
Q4) Define a class Garment in C++ with the following descriptions:
Private Members
GCode of type String
GType of type string
GSize of type integer
GFabric of type string
GPrice of type float
A function Assign() which calculates and assigns the value of GPrice as follows :
For the value of GFabric as “COTTON”
GType GPrice
TROUSER 1300
SHIRT 1100
For GFabric other than “COTTON” the above mentioned GPrice gets reduced by 10%.
Public Members
A constructor to assign initial values of GCode, GType and GFabric with the word “NOT
ALLOTED” and GSize and GPrice with 0.
A function Input() to input the values of the data members GCode, GType. GSize and
GFabric and invoke the Assign() function.
A function Display() which displays the content of all the data members for an Garment.

Q5) Define a class Travel in C++ with the description given below :
Private Members
T_code of type string
No_of_adults of type integer
No_of_children of type integer
Distance of type integer
TotalFare of type float
Public Members
A constructor to assign initial values as follows :
T_Code with the word “NULL”
No_of_adults as 0
No_of_children as 0
Distance and 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 Distance (Km)
500 >=1000
300 <1000 and >=500
200 <500
For each child the above Fare will be 50% of the Fare mentioned in the given table
For example : If distance is 750, No_of_adults = 3 and No_of_children=2
Then TotalFare should be calculated as
No_of_adults * 300 + No_of_children * 150
i.e. 3 * 300 + 2 * 150 = 1200

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in


A.E.C.
Excellence in Computer Education
A function EnterTravel( ) to input the values of data members T_code,No_of_Adults,
No_of_children and Distance. Also invoke the AssignFare( ) function.
A function ShowTravel( ) which displays the content of all the data members for a
Travel.

Q6) Define a class named MOVIE in C++ with the following description :
Private Members
Hall_no integer
Movie_name Array of characters(string)
Weeks integer
Week_collection float
Total_collection float

Public members
Function Read_Data( ) to read an object of MOVIE type
Function Display( ) to display the details of an object
Function Update( ) to update the total collection and weekly collection when the week
changes. Total collection will be incremented by weekly collection and weekly collection
is made zero.

Q7) Define a class named HOUSING in C++ with the following description :
Private Members
Reg_no integer (ranges 10 – 1000)
Name String
Type Character
Cost float
Public Members
Function read_data( ) to read an object of HOUSING type.
Function display( ) to display the details of an object.
Function draw_nos( ) to choose and display the details of 2 houses selected randomly
from an array of 10 objects of type HOUSING. Use random function to generate the
registration nos. to match with Reg_no from the array.

Q8) Define a class cricket in c++ with the following descriptions :


Private members
Target_score of type integer
Overs_bowled of type integer
Extra_time of type integer
Penalty of type integer
Cal_Penality( ) a member function to calculate penalty as follows :
If Extra_time <= 10, penalty = 1
If Extra_time > 10 but <= 20, penalty =2
Otherwise penalty=5
Public Members
A function Enterdata( ) to allow user to enter values for target_score, overs_bowled and
extra_time. Also invoke function cal_penality( )

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in


A.E.C.
Excellence in Computer Education
A function Dispdata( ) to allow user to view the contents of all data members.

Q9) Define a class TRAVEL in C++ with the following descriptions :


Private Members
TravelCode of type long
Place of type string
No_of_travellers of type integer
No_of_buses of type integer
Public Members
A constructor to assign initial values of TravelCode as 201, Place “Nainital”,
No_of_travellers as 10 and No_of_buses as 1
A function NewTravel( ) which allows user to enter TravelCode, Place and
No_of_travellers. Also assign the value of No_of_buses as per the following conditions :
No_of_travellers No_of_buses
Less than 20 1
Equal to or more than 20 and less than 40 2
Equal to 40 or more than 40 3
A function ShowTravel( ) to display the content from all data members on the screen.

Q10) Define a class with complete function definitions COMPETITION in C++ with
following specifications :
Private members
Event_no integer
Description char(30)
Score integer
Qualified char
Public members
Input( ) To take input for event_no, description and score.
Award( ) to assign qualified as ‘y’ if score is more than the cut off score passed as int to
the function, else assign ‘n’.
Show( ) to display all details.

Q11) Declare a class Myfolder with the following specifications :


Private members
Filenames : an array of strings of size (10)(25) (to represent all the names of the files
inside my folder)
Availspace : long (to represent total number of bytes available in my folder)
Usedspace : long (to represent total number of bytes used in my folder)

Public members of the class


Newfileentry() - A function to accept values of Filenames, Availablespace and
Usedspace from user.
Retavailspace( )- A function that returns the value of total Kilobytes available. (1 KB =
1024 bytes)
Showfiles() – A function that displays the names of all the files in myfolder.

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in


A.E.C.
Excellence in Computer Education
Q12) Define a class PUBLISHER with the following specifications :
Private members
IDNumber long
Title 40 characters
Author 40 characters
Price, Stockqty double
Stockvalue double
Valcal( ) A function to find Price * Stockqty with double as return type

Public members
-A constructor function to initialize Price, Stockqty and Stockvalue as 0.
-Enter( ) function to input the IDNumber, Title and Author
-TakeStock( ) function to increment Stockqty by N (where N is passed as argument to
this function) and call the function Valcal( ) to update the Stockvalue.
-Sale( ) function to decrease the Stockqty by N (where N is sale quantity passed to this
function as argument) and also call the function Valcal( ) to update the Stockvalue.
-Outdata( ) function to display all the data members on the screen.

Q13) Define a class Play in C++ with the following specifications :


Private members
Playcode integer
Playtitle 25 character
Duration float
Noofscenes integer
Public members
-A constructor function to initialize Duration as 45 and Noofscenes by 5.
-Newplay( )function to accept values for Playcode and Playtitle.
-Moreinfo( ) function to assign the values of Duration and Noofscenes with the help of
corresponding values passed as parameters to this function.
-Showplay( ) function to display all the data members on the screen.

Q14) Define a class Student with the following specifications :


Private members
Roll_no integer type
Name 20 characters
Class_st 8 characters
Marks array of integers of size 5
Percentage float
Calculate( ) function that calculates percentage of marks and returns the percentage
Public members
Readmarks( ) function to read roll_no, name, class_st and marks. Also invoke calculate
function to assign percentage.
Displaymarks( ) to print all the data members.

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in


A.E.C.
Excellence in Computer Education
Q15) Consider the following specifications :
Structure Name Data Type Size
Name first char 40
Mid char 40
Last char 60
Phone area char 4
Exch char 6
Numb char 6
Define structures in C++ for Name and Phone.
Define a class named P_rec having data members CName and Cphone of type Name and
Phone respectively.
Define the constructor that reads information from the user for the above two structures
Name and Phone.
Define a function display_rec() that shows the current data values.

Q16) Define a class Bank to represent a bank account with the data members as name of
depositor, account number, type of account( S for Savings and C for current), and balance
amount. The class also contains member functions to do the following :
-To initialize the data members
-To read the data members
-To display the data members
- To deposit money
-To withdraw money after checking balance. Minimum balance must be 1000.

AEC – L – 47 D, Saket. Ph :- 9212535516, 9711544202, www.aeceducation.co.in

Вам также может понравиться