Question: Write the Stats class that has three private member variables (num1, num2, and num3; all are integers) and the following member functions: a. Constructor: The

Write the Stats class that has three private member variables (num1, num2, and num3; all are integers) and the following member functions:

a. Constructor: The constructor should accept three integer values as arguments and assign them to the objects member variables. The default constructor should initialize all member variables to 0.

b. getSum: This function calculates and returns the sum of the member variables.

c. getAvg: This function calculates and returns the average value of the member variables.

d. getMin: This function returns the smallest member variable.

e. getMax: This function returns the largest member variables.

f. getMedian: This function finds and returns the median of the three member variables.

Write a program that uses the Stats class to display the sum, the average, the min, the max, and the median values of the objects member variables. The program should ask the user to enter the three integer values using the keyboard.

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!