Question: In c++, define the class called Student. The Student class has the following data members and functions: (a) Private data members: name(string), age(int), units(int). The

In c++, define the class called Student. The Student class has the following data members and functions: (a) Private data members: name(string), age(int), units(int). The units represent the number of quarter units students is enrolled in. (b) Define a default constructor as well as a constructor with parameters for the class Student. (c) The class must have get and set functions for all private data members. The set function for the data member units must throw out_of_range exception if the number of units is not between 1 and 15. (d) Include a function called tuition (double feePerUnit) that computes and returns the cost of registering for the number of units (in the private data member). (e) Overload the insertion (<<) operator to display student name and age. (f) Test the class Student by writing a main program in which a Student object with name = Tim, age =20 and units = 5 is created and displayed. Call the function tution(), you may pass 100 for feePerUnit to this function and display the returned value. Demonstrate that the set function for the units data member throws an out_of_range exception.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!