Demonstrate the ability to
u:\Lab1\ and a new class named SimpleArray.for loops to sequentially process the values in SimpleArray.u:\Lab1\.Lab1 project should consist of one Java class, SimpleArray, that contains one method, main.main method should read in, store, and calculate statistics on list of numbers entered by the user. Follow the sample session shown below:How many numbers would you like to enter?3Please enter the 3 values:5.6 4.5 8.22The values you entered were 5.6 4.5 8.22 Their sum is 18.32 Their average is 6.1066666666666665
SimpleArray.java by the start of class on Wednesday.If you finish early, get yourself checked off first!
Re-save your program as HardArray.java, modify your program to prompt the user for the name of the input file and the number of values to read in from the file. Read in these values, display them, and then calculate and display their total and their average.
Section 5.10 beginning on page 311 of your textbook explains how to read in input from a file. Your HardArray.java program will still need to read in the size of the array from the keyboard.
Sample session: Programming Challenge (optional, not required)
Please enter the name of the input file:numbers.txtHow many numbers to read in?5The values read in were 1.122 2.21 3.3 4.456 5.5555 Their sum is 16.643500000000003 Their average is 3.3287000000000004