1 Cpp Assignment

2
1. Write a Student class and use it in your program. Store the data of ten students and display the sorted data according to their roll numbers, date of births, and total marks. 2. Create two classes DM and DB which store the value of distances. DM stores distances in metres and centimetres and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB. Use a friend function to carry out the addition operation. The object that stores the results may be a DM or DB object, depending on the units in which the results are required. 3. An educational institution wishes to maintain a database of its students. The database is divided into a number of classes whose hierarchical relationships are shown in fig. The figure also shows the minimum information required for each class. Specify all the classes and define functions to create the database and retrieve individual information as and when required. 4. Consider a class network of fig below. The class master derives information from both account and admin classes which in turn derive information from the class person. Define all the four classes and write a program to create, update and display the information contained in master objects. Medical Arts Engineerin g EEE CSE Employee (Name,code) Weekend (time,pay) Weekday (Basic,hra.t a) Salary (Name,Code,Basi c,hra,ta,time,pay, total) Students

description

chk it

Transcript of 1 Cpp Assignment

Page 1: 1 Cpp Assignment

1. Write a Student class and use it in your program. Store the data of ten students and display the sorted data according to their roll numbers, date of births, and total marks.

2. Create two classes DM and DB which store the value of distances. DM stores distances in metres and centimetres and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB. Use a friend function to carry out the addition operation. The object that stores the results may be a DM or DB object, depending on the units in which the results are required.

3. An educational institution wishes to maintain a database of its students. The database is divided into a number of classes whose hierarchical relationships are shown in fig. The figure also shows the minimum information required for each class. Specify all the classes and define functions to create the database and retrieve individual information as and when required.

4. Consider a class network of fig below. The class master derives information from both account and admin classes which in turn derive information from the class person. Define all the four classes and write a program to create, update and display the

information contained in master objects.

MedicalArts Engineering

EEECSE

Employee(Name,code)

Weekend(time,pay)

Weekday(Basic,hra.t

a)

Salary(Name,Code,Basic,hra,ta,time,pay,

total)

Students

Page 2: 1 Cpp Assignment

5. Create a class Time with members hr, min and sec. Write all three constructors, destructor, and make one static member to count the objects of class.Overload the following operators :

>>,<<,<,>,==,=,+,++(both),--(both), (t[0] =>hrs, t[1]=>min, t[2]=>sec