Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 ArrayList 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

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

More Books

Students also viewed these Databases questions