Question: I need help making a stat calc in java ( main ) . Use the partial solution as a format and try to keep everything

I need help making a stat calc in java (main). Use the partial solution as a format and try to keep everything beginner level.
A common programming task is computing statistics of a set of numbers. (A statistic is a number that summarizes some property of a set of data.) A common statistic include the mean (also known as the average). StatCalc can be used to compute these statistics, as well as the sum of the items in the dataset and the number of items in the dataset. Ifcalcis an object of typeStatCalc, then the following methods are defined:
calc.enter(item);whereitemis a number, adds the item to the dataset.
calc.getCount()is a function that returns the number of items that have been added to the dataset.
calc.getSum()is a function that returns the sum of all the items that have been added to the dataset.
calc.getMean()is a function that returns the average of all the items.
Typically, all the data are added one after the other calling theenter()method over and over, as the data become available. After all the data have been entered, any of the other methods can be called to get statistical information about the data. The methodsgetMean() should only be called if the number of items is greater than zero.
Add instance methodsgetMax()andgetMin(). ThegetMax()method should return the largest of all the items that have been added to the dataset, andgetMin()should return the smallest. You will need to add two new instance variables to keep track of the largest and smallest items that have been seen so far.
Test your new class (Test.java) by using it in a program to compute statistics for a set of non-zero numbers entered by the user. Start by creating an object of typeStatCalc:
StatCalc calc; // Object to be used to process the data. calc = new StatCalc();
Read numbers from the user and add them to the dataset. Use 0 as a sentinel value (that is, stop reading numbers when the user enters 0). After all the user's non-zero numbers have been entered, print out each of the six statistics that are available fromcalc.
Partial Solution:
public class TestStats
{
public static void main(String[] args)
{
int userNum;
StatsCalc test1= new StatsCalc();
do{
userNum = test1.enterItem();
if (userNum !=0){
test1.displayStats();
}
}while (userNum !=0);
}
}
//import Scanner
public class StatsCalc {
//notice there is no main method here
public class Calc {
/*instance variables go here
-do not include Standard Deviation
remove this and any associated methods
from your class
-if Scanner is imported to this class,
then a new object should be here too
*/
//defult constructor
public StatsCalc(){
}
public StatsCalc(int uN){
/*
If the user input is coming from the other class,
then you need a parameter constructor too
*/
}
public double enterItem(){
//This is a good spot to give the user instructions
//this could be void if Scanner is instantiated in TestStats
userNumber = io.nextDouble();
return userNumber;
}
public void getMax(){
if (xxxxxxxxxxxx > yyyyyyyyy){
yyyyyyyyyy = xxxxxxxxxx;
}
}
public void getMin(){
}
public void displayStats(){
getMax();
getMin();
//output to the user goes here
}
}

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 Programming Questions!