Question: In this assignment, you are asked to write a Java class (MyNumbersClass) that calculates the average of real numbers (double) using the ArrayList. The numbers
In this assignment, you are asked to write a Java class (MyNumbersClass) that calculates the average of real numbers (double) using the ArrayList. The numbers are separated by a white space and are stored in a dat file. Refer to the UML design below. Specifications: 1- The field filename stores the file that contains the numbers. 2- The default constructor sets the file name to a default String ("input.dat") and creates the ArrayList object field with a capacity of 100 . 3- The second constructor assigns the value of the argument to the filename field. 4. The ReadnumbersfromFile method reads the numbers from the file and stores them in the ArrayList object field. 5- The CalcAverage method iterates over all elements in the ArrayLit object field and computes the average of the stored numbers. It returns the average value to the caller
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
