Question: 1. Write a program called Numbers that a. prompts the user for a file name. b. reads that file assuming that its contents consist entirely

 1. Write a program called Numbers that a. prompts the user

1. Write a program called Numbers that a. prompts the user for a file name. b. reads that file assuming that its contents consist entirely of integers. c. prints the maximum, minimum, sum, count (number of integers in the file), and average of the numbers. For example, if the file numberinput.dat has the following content: 4 -2 18 15 31 27 Your program should produce the following output: csc% java Numbers Enter file name: numberinput.daft Maximum31 Minimum- -2 Sum - 93 Count -6 Average - 15.5 2. When you have your Numbers program working correctly, modify it so that it works even on an input file that contains non-integer tokens. Your code should skip over any tokens that are not valid integers. For example, if the file input2.dat has the following contents: 4 -2 Is 18 it time to 15 leave 31 yet?? 27 your program should produce the same output as shown above

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!