Classes Assignment
Classes Assignment
COMPUTER SCIENCE
CLASS XII
Assignment : Classes, Objects & Constructor (2009-10)
Define a function draw_nos() which takes an array of Housing as parameter, chooses and
displays the details of 2 houses selected randomly from the array. Use random function to
generate the registration no.
Member functions:
• Define constructor (outside the class P_rec) that accepts the values of data
• members from the user.
• Define the display_rec (outside the class P_rec) that shows the current values .
• Declare structures in C++ for Name and Phone . Declare the class P_rec.
8. Declare a class bank to represent bank account of 10 customers with the following data
members: name of depositor, account number, type of account(s for savings and c for current
account), balance amount. The class also contains the following member functions:
• To initialize data members.
• To deposit money
• To withdraw money after checking minimum balance (say 1000)
• To display the data members on screen.
9. Answer the questions(i) and (ii) after going through the following class :
class Exam
{
int year;
public :
Exam(int y) { year=y; }
Exam(Exam &t);
}
(i) Create an object, such that it invokes constructor 1.
(ii) Write complete definition for constructor 2.