Question: Write a function calculateAverage() which takes four int arguments which are marks for four courses in the semester and returns their average as a float.

Write a function calculateAverage() which takes four int arguments which are marks for four courses in the semester and returns their average as a float. The calculateAverage() function should take only valid range for marks which is between 0 - 100. If the marks are out of range throw an OutOfRangeException - define this exception as a class as shown in the lecture and lecture examples. Write the specification for this function as comments above it specifying the pre conditions, post conditions and invariants and what exceptions are thrown when so that the caller understand how it behaves. (USE C++)

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!