Friday, March 13, 2009

OOPS ASSIGNMENT - 9

Inheritance

1. Write a program which should have two classes A and B,A contain two data members and 3 methods and B class is inherited by class A, Class B contains one data member and two methods. Now multiply the two values of class A by using the object of class B and display the result.

2. Write a program which having 3 classes student, test and result, student class having method to accept enrollment number, test class accept student marks in 3 subjects which is inherited by class student and result class having methods to find sum of marks and displays, which is inherited by class test. Now by using the object of result class call the methods from other classes.


3. Create a class Basic_info having data members Player ID, Name, Age. Derive a class Add_info from Basic_info having data members player_type, height & weight. Include suitable member functions to input and display the data?


4. A bank maintains two types of accounts
Saving: includes
Compound interest
Withdrawal
Current
Minimum balance required

Create a class “account” that stores customer name, account number and type of account. From account derive cur_acc and sav_acc. Include necessary data members and member function to perform following tasks.

i. Accept deposit and update balance
ii. Display the balance
iii. Compute and deposit interest
iv. Check for minimum balance


5. Create a class student which includes name and roll number of the student. Derive classes test and sport out of class student which include test marks and sport marks respectively.

Derive a class result out of test and sport where total marks are calculates and displayed

Test the class result.

No comments: