Sei sulla pagina 1di 5

WWW.VIDYARTHIPLUS.

COM

SET 2

ANNA UNIVERSITY : CHENNAI – 600 025


B.E/B.Tech Degree Examinations, Nov-2013

CS2209-OBJECT ORIENTED PROGRAMMING LAB

(B.E Computer Science and Engineering (Common To B.Tech IT))


Regulations - 2008
Time: 3 Hours Maximum Marks: 100
Date : 5/11/13 ,6/11/13 &7/11/13 Session : FN & AN

1 a 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.
50
b Create a class Employee with members empno , name , deptname and designation
as private variables. Create a friend function LiseDeptWise to list all employees for
a given dept.
50
2 a Create a class Point with xcod and ycod as data members. Include member
functions to read and print the coordinate values as getPoint() and showPoint()
respectively. Write a main method to demonstrate the Point class.
50
b Create a class Student with regno, name, CS1201, CS1202, CS1203 as data
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 student’s
details and display the result in the form of list.
3 50
a Create a class Date with day, month, and year as data members. Include getDate()
and showDate() as member function to read and print the date respectively. Write a main
method to demonstrate the Date class.
50
b Write a program to overload new and delete operators to manipulate objects of
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.
50
4 a Create a class Time with hour, minute and second as data members. Include the
methods getTime() and showTime as member function to read and print a time
value respectively. Write a main method to demonstrate the Time class.
50
b Create a class Complex with real and imag as data member. Use binary operator
overloading to read and add the member values. Write a main method to demonstrate
the Complex class.
WWW.VIDYARTHIPLUS.COM

50
5 a Create a class Computer with brand, memory capacity and processor type as data
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.
50
b Consider an example of declaring the examination result. Design three classes:
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.
50
5 a Create a class Complex with real and imag as data member. Include a constructor
and a member function showComplex() to assign and print the member values
respectively. Write a main method to demonstrate the Complex class.
50
b Create a class called Circle with radius as data member and getCircle() and
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.
6 50
a Create a class Student with name, age, degree and branch as data members. Include
a constructor and a member function printStudent() to set and print the member values
respectively. Write a main method to demonstrate the Student class

b 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
8 a 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
b
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.
WWW.VIDYARTHIPLUS.COM

Create a class Distance with meter and centimeter as data members. Include a 50
9 a 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
b 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.

Create a class Television with model number, brand, and price as data members. 50
10 a 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
b 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.

Create a class Student with regno, name and marks as non-static data members and 50
11 a 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
b 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.

Create a class matrix with rows and cols as data members. Get rows and cols values 50
12 a 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
b 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.
WWW.VIDYARTHIPLUS.COM

Create a class Book with necessary data members and member functions. Derive a 50
13 a 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.

b 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
14 a 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
b
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
15 a 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
b 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
16 a 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
b
file, read the numbers using input file stream and perform complex addition .Store
the resultant complex number in another file.
17 a 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 object’s value to all remaining objects by using Copy
constructor

b 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.
WWW.VIDYARTHIPLUS.COM

Create a class Matrix with rows, cols and a two dimensional arrays data members. 50
18 a 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
b
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
19 a
members. Use member functions to read and print the member values. Write a main
method to demonstrate the Address class.

b 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
20 a
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
b
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.

Potrebbero piacerti anche