Merged Removed
Merged Removed
Merged Removed
PRACTICAL RECORD
Section/ Group : I1
PRACTICAL DETAILS
5. Create a class time with members hours, minutes and seconds. Take
input and add two time objects passing objects to functions and
display results.
6. Create a class student which has data members as name, branch, roll
no., age, gender, and marks in 5 subjects. Display the names of the
students and his percentage who has more than 70%. Use an array
objects.
10 Write a program to find the biggest of three numbers using friend function.
11. Write a program to demonstrate the use of friend function with Inline
assignment.
12. Write a program to find the greatest of two given numbers in two different
classes using friend function.
13. Imagine a publishing company that markets both book and audiocassette
versions of its works. Create a class publication that stores the title (a
string) and price (type float) of a publication. From this class derive two
classes: book, which adds a page count (type int), and tape, which adds a
playing time in minutes (type float). Each of these three classes should
have a getdata() function to get its data from the user at the keyboard,
and a putdata() function to display its data. (Simple inheritance &
method overriding)
14. C++ program to read and print employee information using multiple
inheritance. The program has following classes:
1. basicInfo
a. Data: name[char,30],empId[int], gender[char]
b. Functions: getData(), putData();
2. deptInfo
a. Data: deptName[char,30], assignWork[char,30], timeToComplete(int)
b. Functions: getData(), putData();
3. employeeInfo
a. Data: salary[int], age[int]
b. Functions: getData(), putData();
15. Design three classes STUDENT ,EXAM and RESULT. The STUDENT
class has data members such as rollno, name. create a class EXAM by
inheriting the STUDENT class. The EXAM class adds data members
representing the marks scored in six subjects. Derive the RESULT from
the EXAM class and has its own data members such as total marks. Write
a program to model this relationship.
16. Create class first with data members book no, book name and member
function getdata and putdata. Create a class second with data members
author name ,publisher and members getdataand showdata. Derive a class
third from first and second with data member no of pages and year of
publication. Display all these information using an array of objects of third
class.
17. Create a base class called SHAPE. Use this class to store two double type
values. Derive two specific classes called TRIANGLE and RECTANGLE
from the base class. Add to the base class, a member function getdata to
initialize base class data members and another member function display to
compute and display the area of figures. Make display a virtual function
and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept driven of a
TRIANGLE or RECTANGLE interactively and display the area.
18. Create a base class basic_info with data members name ,roll no, gender
and two member functions getdata and display. Derive a class physical_fit
from basic_info which has data membersheight and weight and member
functions getdata and display. Display all the information using object of
derived class.
19. Write a program to overload less than (<) operators.
22. Write a program to define the function template for swapping two items of
the various data types such as integer ,float,and characters.
23. Write a program to define the function template for calculating the square
of given numbers with different data types.
25. Write a program to illustrate how to define and declare a class template for
reading two data items from the keyboard and to find their sum.
27. Write a program to read a set of lines from the keyboard and to store it on
a specified file.
28. Write a program to read a text file and display its contents on the screen.
30. Write a program to read the class object of student_info such as name , age
,sex ,height and weight from the keyboard and to store them on a specified
file using read() and write() functions. Again the same file is opened for
reading and displaying the contents of the file on the screen.
LAB FILE OF
5. Create a class time with members hours, minutes and seconds. Take
input and add two time objects passing objects to functions and
display results.
6. Create a class student which has data members as name, branch, roll
no., age, gender, and marks in 5 subjects. Display the names of the
students and his percentage who has more than 70%. Use an array
objects.
10 Write a program to find the biggest of three numbers using friend function.
11. Write a program to demonstrate the use of friend function with Inline
assignment.
12. Write a program to find the greatest of two given numbers in two different
classes using friend function.
13. Imagine a publishing company that markets both book and audiocassette
versions of its works. Create a class publication that stores the title (a
string) and price (type float) of a publication. From this class derive two
classes: book, which adds a page count (type int), and tape, which adds a
playing time in minutes (type float). Each of these three classes should
have a getdata() function to get its data from the user at the keyboard,
and a putdata() function to display its data. (Simple inheritance &
method overriding)
14. C++ program to read and print employee information using multiple
inheritance. The program has following classes:
1. basicInfo
a. Data: name[char,30],empId[int], gender[char]
b. Functions: getData(), putData();
2. deptInfo
a. Data: deptName[char,30], assignWork[char,30], timeToComplete(int)
b. Functions: getData(), putData();
3. employeeInfo
a. Data: salary[int], age[int]
b. Functions: getData(), putData();
15. Design three classes STUDENT ,EXAM and RESULT. The STUDENT
class has data members such as rollno, name. create a class EXAM by
inheriting the STUDENT class. The EXAM class adds data members
representing the marks scored in six subjects. Derive the RESULT from
the EXAM class and has its own data members such as total marks. Write
a program to model this relationship.
16. Create class first with data members book no, book name and member
function getdata and putdata. Create a class second with data members
author name ,publisher and members getdataand showdata. Derive a class
third from first and second with data member no of pages and year of
publication. Display all these information using an array of objects of third
class.
17. Create a base class called SHAPE. Use this class to store two double type
values. Derive two specific classes called TRIANGLE and RECTANGLE
from the base class. Add to the base class, a member function getdata to
initialize base class data members and another member function display to
compute and display the area of figures. Make display a virtual function
and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept driven of a
TRIANGLE or RECTANGLE interactively and display the area.
18. Create a base class basic_info with data members name ,roll no, gender
and two member functions getdata and display. Derive a class physical_fit
from basic_info which has data membersheight and weight and member
functions getdata and display. Display all the information using object of
derived class.
19. Write a program to overload less than (<) operators.
23. Write a program to define the function template for calculating the square
of given numbers with different data types.
24. Write a program to illustrate how template functions can be overloaded.
25. Write a program to illustrate how to define and declare a class template for
reading two data items from the keyboard and to find their sum.
26. Write a program to demonstrate the use of special functions, constructor
and destructor in theclass template. The program is used to find the biggest
of two entered numbers.
27. Write a program to read a set of lines from the keyboard and to store it on
a specified file.
28. Write a program to read a text file and display its contents on the screen.
30. Write a program to read the class object of student_info such as name , age
,sex ,height and weight from the keyboard and to store them on a specified
file using read() and write() functions. Again the same file is opened for
reading and displaying the contents of the file on the screen.