Assignment 1 CPE
Assignment 1 CPE
Task 03:
Write a class Result that contains roll no, name, and marks of three subjects. The marks are
stored in an array of integers. The class also contains the following member functions:
The input() function is used to input the values in data members. The total() function returns
the total marks of a student.
Define the functions within the class. Lastly, create a pointer to the object and use that
to input values and display sum.
Task 04:
Write a program that declares a class xyz with private data members: id, pages and price
of a book.
Define member function outside class. Program should define an array as an object of
class, inputs the records of three books via input() member function, calculate the most
expensive book in main function, and displays the record of most costly book in
expensive() function.
Help: To calculate most expensive book in MAIN FUNCTION you have to use getter
functions for price.
Task 05:
Passing object to the class function
Declare a class that contains an integer data member and 2 member function: input() &
output(). Create two objects: obj1 and obj2. Input integer value in input() function using both
objects. Calculate sum of values of both objects and display result in output() function by
passing obj2 to the output() function.