Question: Write a program that reads a set of floating-point values. Ask the user to enter the values (prompting only a single time for the values),
Write a program that reads a set of floating-point values. Ask the user to enter the values (prompting only a single time for the values), then print:
-the average of the values.
-the smallest of the values.
-the largest of the values.
-the rage, that is the difference between the smallest and largest.
Your program should use a class DataSet. That class should have a method public void add(double value) and methods getAverage, getSmallest, getLargest, and getRange.
Use the following basic constructor and then create a Tester:
public class DataSet { double sum, count, max, min; public DataSet() { } public void add(double number) { // provide code for this method } public double getAverage() { // provide code for this method } // you can define more methods too as you need them public boolean hasData() { // provide code for this method } Step by Step Solution
There are 3 Steps involved in it
To solve this problem we will design a Java program with a class named DataSet which contains the necessary methods to compute the desired statistical ... View full answer
Get step-by-step solutions from verified subject matter experts
