Write a program that prompts the user for a file name, then reads that file (assuming that its contents consist entirely of integers) and prints the maximum, minimum, sum, count (number of integers in the file), and average of the numbers. For example, if the file num_input.dat has the following contents: 4 -2 18 15 31 27 Your program would produce the following output: What is the name of the input file? numberinput.dat Maximum = 31 Minimum = -2 Sum = 93 Count = Average = 15.5

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
100%

Write the java program that will prdoce the output below

a. Write a program that prompts the user for a file name, then reads that file
(assuming that its contents consist entirely of integers) and prints the maximum,
minimum, sum, count (number of integers in the file), and average of the
numbers. For example, if the file num_input.dat has the following contents:
4 -2 18
15 31
27
Your program would produce the following output:
What is the name of the input file? numberinput.dat
Maximum = 31
Minimum = -2
Sum = 93
Count =
6
Average = 15.5
Transcribed Image Text:a. Write a program that prompts the user for a file name, then reads that file (assuming that its contents consist entirely of integers) and prints the maximum, minimum, sum, count (number of integers in the file), and average of the numbers. For example, if the file num_input.dat has the following contents: 4 -2 18 15 31 27 Your program would produce the following output: What is the name of the input file? numberinput.dat Maximum = 31 Minimum = -2 Sum = 93 Count = 6 Average = 15.5
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Top down approach design
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning