Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Is there just cause to dismiss Bonita? Explain your answer.

Answered: 1 week ago

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago