You are on page 1of 5

ANNA UNIVERSITY : CHENNAI 600 025 B.E/B.Tech Degree Examinations, Oct-Nov-2012 CS2209-OBJECT ORIENTED PROGRAMMING LAB (B.

.E Computer Science and Engineering (Common To B.Tech IT)) Regulations - 2008 Time: 3 Hours 1 a Maximum Marks: 100

Create a class Complex with real and imag as data members. Include a member 50 function to read and print the member value as readComplex() and printComplex() respectively. Write a main method to demonstrate the Complex class. Create a class Employee with members empno , name , deptname and designation 50 as private variables. Create a friend function LiseDeptWise to list all employees for a given dept. Create a class Point with xcod and ycod as data members. Include member 50 functions to read and print the coordinate values as getPoint() and showPoint() respectively. Write a main method to demonstrate the Point class. Create a class Student with regno, name, CS1201, CS1202, CS1203 as data 50 members. Overload the stream operator to get and display the student details. Include a member function to find the total and publish the result. Get minimum of five students details and display the result in the form of list. Create a class Date with day, month, and year as data members. Include getDate() 50 and showDate() as member function to read and print the date respectively. Write a main method to demonstrate the Date class. Write a program to overload new and delete operators to manipulate objects of 50 student class. The student class must contain data members such as char *name, int rollno, char* branch etc. The overload new and delete operators must allocate memory for the student class object and its data members. Create a class Time with hour, minute and second as data members. Include the 50 methods getTime() and showTime as member function to read and print a time value respectively. Write a main method to demonstrate the Time class. Create a class Complex with real and imag as data member. Use stream operator 50 overloading to read and print the member values. Write a main method to demonstrate the Complex class.

Create a class Computer with brand, memory capacity and processor type as data 50 members. Include the methods getComputer() and showComputer() as member function to read and print the members. Write a main method to demonstrate the Computer class. Consider an example of declaring the examination result. Design three classes: 50 Student, Exam and Result. The student class has data members such as roll number, name, etc. Create the class Exam by inheriting the Student class. The Exam class adds data members to representing the marks scored in six subjects. Derive the Result class from the Exam class and it has its own data members such as total_marks. Write an interactive program to model this relationship. Create a class Complex with real and imag as data member. Include a constructor 50 and a member function showComplex() to assign and print the member values respectively. Write a main method to demonstrate the Complex class. Create a class called Circle with radius as data member and getCircle() and 50 calcArea() as member functions to read the radius and calculate area of the circle. Create another class called Cone which is derived from the Circle class. Utilize the data members and the member functions of the base class by the derived class to find the volume ((1/3)*3.14*r*r*h) of a cone. Create a class Student with name, age, degree and branch as data members. Include 50 a constructor and a member function printStudent() to set and print the member values respectively. Write a main method to demonstrate the Student class Design classes Polar and Rectangle for representing a point in the polar and 50 rectangle systems. Support data conversion function to support statements such as Rectangle r1, r2 Polar p1, p2 r1=p1 p2=r2

Create a class Book with title, author, and cost as data members.Include a 50 constructor and a member function showBook() to set and print the member values respectively. Write a main method to demonstrate the Book class. Develop a class Date with data members day, month and year. Include appropriate 50 methods to get and display the date in the form of dd/mm/yy. Write a C++ program to throw the exception if the input is invalid date/month.

Create a class Distance with meter and centimeter as data members. Include a 50 constructor and a member function showDistance( ) to set and print the member values respectively. Write the main method to demonstrate the Distance class. Design a class Array as a template class with a single dimensional array and size of 50 the array as data members. Include a methods getArray() and printArray() as member functions to read and print the elements of the array. Write a method to sort the array elements using bubble sort algorithm. Also write a main method to get different types of input to perform the sorting operation.

10 a

Create a class Television with model number, brand, and price as data members. 50 Include a constructor and a member function showTelevision() to set and print the member values respectively. Write a main method to demonstrate the Television class. Design a class Array as a template class with a single dimensional array and size of 50 the array as data members. Include a methods getArray() and printArray() as member functions to read and print the elements of the array. Write a method to sort the array elements using insertion sort algorithm. Also write a main method to get different types of input to perform the sorting operation.

11 a

Create a class Student with regno, name and marks as non-static data members and 50 Passingmark as static data member. Write a function Checkpassing() to display the status pass/fail for a given student. Design a class Array as a template class with a single dimensional array and size of 50 the array as data members. Include a methods getArray() and printArray() as member functions to read and print the elements of the array. Write a method to sort the array elements using merge sort algorithm. Also write a main method to get different types of input to perform the sorting operation.

12 a

Create a class matrix with rows and cols as data members. Get rows and cols values 50 as Default Arguments for the getmatrix() function. Perform matrix addition for the matrices with Default arguments(2x2 or 3x3). Design a class Array as a template class with a single dimensional array and size of 50 the array as data members. Include a methods getArray() and printArray() as member functions to read and print the elements of the array. Write a method to sort the array elements using quick sort algorithm. Also write a main method to get different types of input to perform the sorting operation.

13 a

Create a class Book with necessary data members and member functions. Derive a 50 class Textbook from the Book class and include the necessary data members and member functions to get and print the information with the help of base class members. Create a class Stack with functions push() and pop().Check whether the Stack is 50 full or empty and accordingly raise exceptions as Stack Overflow or Stack Underflow. Create a class called Point with the data member of x and y coordinates. Write a 50 member function to get and display the point. Overload the + and operator to perform addition and subtraction of two points. Create a class Queue with functions insert() and delete().Check whether the Queue 50 is full or empty and accordingly raise exceptions as Queue is full or Queue is empty. Create a class Vector with size as static data member and an integer array as one 50 dimensional pointer data type. Use appropriate constructor and destructor to allocate and de-allocate memory for the vector data member. Create classes for Point, Shape, Rectangle, Square, Circle, Ellipse and Triangle 50 with suitable hierarchy. Design a simple test application to demonstrate Runtime polymorphism Create a class called Circle with radius as data member and getCircle() and 50 calcArea() as member functions to read the radius and calculate area of the circle. Create another class called Cylinder which is derived from the Circle class. Utilize the data members and the member functions of the base class by the derived class to find the volume (3.14*r*r*h) of a cylinder. Create a class Complex and read two complex numbers and store in a file. Open the 50 file, read the numbers using input file stream and perform complex addition .Store the resultant complex number in another file. Create a class Code having a private data member id. Create an object and assign 50 the value for the data member using one argument constructor. Create multiple objects and assign the first objects value to all remaining objects by using Copy constructor Create a class Student with data members name, rollno and dept. Open a file to 50 store the student object. Open the same file in ios::in mode to read and display the contents.

14 a

15 a

16 a

17 a

18 a

Create a class Matrix with rows, cols and a two dimensional arrays data members. 50 Overload the assignment operator to assign one matrix object to another matrix object. Create a class Number with a data member value as pointer data type. Overload the 50 new and delete operator to allocate and de-allocate memory for its memory. Equip a C++ program to get and display the value of number object. Create a class Address with house No., street name, city, and pincode as data 50 members. Use member functions to read and print the member values. Write a main method to demonstrate the Address class. Create a class Time to display a time value with the data members of hours, 50 minutes and seconds. Include the member functions to get and display the time separated by: (HH:MM:SS). Assume the time is represented in 12 hours. If the input value exceeds the hour, minute and second then your function should report the exception as invalid hour/minute/second. Write the C++ program to model the above relationships. Create a class Vector with a single dimensional array, and size as data members. 50 Use friend functions to read and print the member values. Write a main method to demonstrate the Vector class. Create a class Complex with real and imag as pointer data type. Overload the new 50 and delete operator to allocate and de-allocate memory for its data members. Equip a C++ interactive program to get and display the complex value.

19 a

20 a

You might also like