.

Sunday, March 3, 2019

Object-oriented Programming and Data Member

research lab Task Q1 Create a elucidate that includes a entropy part that holds a serial spell for for each one target area created from the class. That is, the first endeavor created will be numbered 1, the second 2, and so on. To do this, youll occupy some other data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole non to individual objects. What keyword specifies this? ) Then, as each object is created, its detergent builder can strain this count member variable to determine the appropriate serial number for the new object.Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each one about its serial number. They should respond I am object number 2, and so on. Use copy constructor for this task both deep and shallow copy. Q2 Create a class calculator. It would have twain data members, both integer type s. There would be four functions add(), sub(), mul() and div(). The mul() and div() functions would be hero functions. Create four objects of the class. Also use copy constructor both shallow and deep copy.There would be a static data member which would count the number of objects. Q3 Create a class GPACalculator. This class would have gpa, cgpa, sessionalMarks, midMarks and finalMarks data members. There would be two functions calculateGPA() and calculateCGPA(). calculateCGPA() would be friend function. You need to create an array of GPACalculator class. The array would be of 5. You also need to give the user option of whether he wants to calculate gpa or cgpa. The grades are as follows 50 and 53 and 57 and 61 and 64 and 68 and 72 and 75 and 80 and 86 and

No comments:

Post a Comment