Complete the following tasks: a. Create a function template named average(). It accepts two arguments of the same type and computes their arithmetic average. The average is returned as a double. b....



Complete the following tasks:


a. Create a function template named average(). It accepts two arguments of the same type


and computes their arithmetic average. The average is returned as a double.


b. Overload the average()function to work correctly with three arguments.


c. Create a class named CollegeCourse with fields for the course ID (for example, ‘ENG 101’),


your grade (for example, ‘A’), and the credits earned for the CollegeCourse (for example, 3).


The CollegeCourse constructor accepts values for these fields as arguments, and calculates


a fourth field named honorPoints. Calculate honorPoints as the product of the grade


points (4 for an A, 3 for a B, 2 for a C, and 1 for a D) and the credits. Overload the + operator


so that honor points for courses can be summed to create a summary CollegeCourse


object. Overload the / operator so that a CollegeCourse object’s honorPoints


can be divided by an integer. Overload the <>


CollegeCourse.


d. Write a main()function that declares several integers, doubles, and CollegeCourses,


and demonstrates that both versions of average()work correctly with different arguments.


Save the file as Averages.cpp.


e. Design a class of your choice where averaging objects makes sense. Include any necessary member functions so the class can be demonstrated using the average()template


functions, and write a main()function that provides the demonstration. Save the file as


Averages2.cpp.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here