You are on page 1of 4

ANNA UNIVERSITY: CHENNAI 600 025 M.C.A.

. DEGREE EXAMINATIONS, MAY\JUNE - 2012 Second Semester MC9227 OBJECT ORIENTED PROGRAMMING LAB (Regulations 2009)

Time: 3 Hours

Maximum Marks: 100

1.

Consider a class Mobile with data members number and balance. Write a 100 constructor to initialize the values of the data members. Write a member function make_Call which reduces the balance by Rs.2. Write a member function receive_call which reduces the balance by Rs.1. Write member

functions recharge and display_balance to increase the balance amount by Rs.100 and to display the current balance respectively at any time.

2.

Consider a class Arithmetic with two integers and two float numbers as data 100 members. Write a default and parameterized constructor. Write a destructor. Write member functions add, subtract, and multiply to do the corresponding arithmetic operations on the data members. Also write member functions to accept numbers from users and also to display the arithmetic result.

3.

Consider a class Arithmetic with two integers and two float numbers as data 100 members. Write a default and parameterized constructor. Write a destructor. Write member functions to input values from user. Overload the + operator to add two arithmetic objects.

4.

Consider a class Distance with feet and inches as data members. Overload the 100 + operator to add two distance objects. (Note: Since 12 inches is equal to one feet, after addition, if the inches exceeds 12 inches then delete 12 from the result and add 1 to the feet).

5.

Write a program to display the number of objects created and number of objects 100 destroyed. Also display the number of objects alive.

6.

Consider a base class Employee with EID and basic as data members. Create a 100 pure virtual function calculate Salary in the base class. Derive two classes Manager and Worker form the Employee class. Other than basic salary, manager is eligible to get incentive for less number of defects in product. If the number of defects is less than 25, he gets an incentive of Rs.5000 else it is Rs.2000. Other than basic, the worker receives incentives for number of products produced. For every product, an incentive of Rs.10 is provided. Write a C++ program to compute the salary for manager and worker by overriding the pure virtual function. Call the base class constructor through the derived class constructor.

7.

Write a c++ program to demonstrate hierarchical inheritance using Vehicle 100 (data member VID), car (data member year and cost) and Maruthi (data member model number and mileage) classes. Assume set of member functions in each classes

8.

Write a C++ program to demonstrate multiple inheritance using the classes 100 Teacher (data members CourseID, Coursename) , Student (data members Course_registered, Course_grade) and Researcher. Include constructor in each class and set of member functions in each classes.

9.

Consider a Shape class with pure virtual function calculate_Area. Derive two 100 classes Circle and Rectangle and override the pure virtual function to calculate area. Write a C++ program to demonstrate run time polymorphism.

10.

Consider a class Distance with feet and inches as data members. Overload the 100 > operator to compare two distance objects. Include copy constructor and destructor in the C++ program and write a main method to demonstrate the comparison of objects.

11.

Write a C++ program to implement a stack. Assume that the stack stores set of 100 integers in it. Write a copy constructor and destructor. Write member functions push, pop, isEmpty, isFull and display_Stack.

12.

Consider a Money class with rupee and coin as data members. Write a 100 constructor and destructor for this class. Overload the prefix and postfix addition operator to increment the Money object by one Rupee.

13.

Consider a class Addition with two data members of integer, float, and string. 100 Overload the add member function to add the integers, float and string data members. Write a C++ program to demonstrate the Addition class.

14.

Write a C++ program to demonstrate hybrid inheritance.

100

15.

Write a function template to find the maximum of an array of different types.

100

16.

Write a class template to implement a stack and include member functions 100 push, pop, isFull and isEmpty in that class. Write a C++ program to demonstrate the template class.

17.

Write a class template to implement a linked list. Write member functions to 100 create list, insert_element, and display_list. Write a C++ program to demonstrate the class.

18.

Consider a class Matrix with m X n integers as data members. Write a member 100 function to input values for the matrix. Write member function to transpose the matrix. Also write a member function to display the original and transposed matrices in matrix format.

19.

Consider two base classes Base1 and Base2 with data members i,j and j,k in 100 these two classes. Derive a class Derived1 from Base1 and Base2. Demonstrate the use of virtual derivation by using these classes.

20.

Write a C++ program to demonstrate multi level inheritance with at least three 100 levels. Provide constructor and destructor in all the three classes and show the order of execution of constructors and destructors.

You might also like