Question: generic lab Start with the DataSet class and make it into a generic DataSetGen class. Test it with the DataSetTester. The DataSetTester uses the BankAccount

generic lab

Start with the DataSet class and make it into a generic DataSetGen class. Test it with the DataSetTester. The DataSetTester uses the BankAccount and BaseballPlayer classes. Do not change any of the classes except DataSet. Upload your DataSetGen.java

dataset

/** Computes the average of a set of data values. */ public class DataSet { private double sum; private Measurable maximum; private int count; /** Constructs an empty data set. */ public DataSet() { sum = 0; count = 0; maximum = null; } /** Adds a data value to the data set. @param x a data value */ public void add(Measurable x) { sum = sum + x.getMeasure(); if (count == 0 || maximum.getMeasure() < x.getMeasure()) maximum = x; count++; } /** Gets the average of the added data. @return the average or 0 if no data has been added */ public double getAverage() { if (count == 0) return 0; else return sum / count; } /** Gets the largest of the added data. @return the maximum or 0 if no data has been added */ public Measurable getMaximum() { return maximum; } } 

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!