Question: Write a program that asks the user to enter the name of a file that contains a set of integer values, and then asks the

Write a program that asks the user to enter the name of a file that contains a set of integer values, and then asks the user to enter an integer number. The program should display the average of the numbers that are greater than the input number. User Notepad or another text editor to create a simple file that can be used to test the program. First, the user enters the file name as below: Enter the file name: myText.txt and if, for example, the file mytext.txt contains the following numbers: 30 44 23 56 43 2 32 35 90 12 and then, if the user enters an integer number, as: The number to check: 40 the program should display the output as: The average of the numbers that are greater than 40 is 58.25 Note that average of numbers 44, 56, 43 and 90 is 233/4 = 58.25. The average must be shown up to two decimal points. (Hint: DecimalFormat class can be used). If the input file is not found, the user must be prompted to enter the filename again with the following message File is not found, enter the filename again.

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!