Computers and Technology, 09.04.2020 16:24 smilequi9653
Write a program that asks the user to enter the name of an input file. The program should read all the numbers from the given file and display the count, total, and average of all numbers in the following format (use three decimal digits for total and average):
Count: n
Total: .nnn
Average: .nnn
Requirements: You should assume that the file contains floating point numbers. Total and average should be properly formatted to display three decimal digits. If the file is empty, do not attempt to calculate the total and average, just display a message and exit the program. If the file does not exist, then display a message and allow the user to enter a new name.
View required output
Test Case 1
Standard Input Files in the same directory
double_input1.txt
double_input1.txt
double_input2.txt
double_input3.txt
Please enter the file name or type QUIT to exit:\n
Count: 100\n
Total: -5,748.583\n
Average: -57.486\n
Test Case 2
Standard Input Files in the same directory
double_input2.txt
double_input1.txt
double_input2.txt
double_input3.txt
Please enter the file name or type QUIT to exit:\n
Count: 2000\n
Total: 112,546.485\n
Average: 56.273\n
Test Case 3
Standard Input Files in the same directory
double_input4.txtENTER
double_input1.txt
double_input1.txt
double_input2.txt
double_input3.txt
Please enter the file name or type QUIT to exit:\n
File: double_input4.txt does not exist.\n
Please enter the file name again or type QUIT to exit:\n
Count: 100\n
Total: -5,748.583\n
Average: -57.486\n
Test Case 4
Standard Input Files in the same directory
double_input3.txt
double_input1.txt
double_input2.txt
double_input3.txt
Please enter the file name or type QUIT to exit:\n
File double_input3.txt is empty.\n
Answers: 1
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
Computers and Technology, 23.06.2019 22:20
What is a programming method that provides for interactive modules to a website?
Answers: 1
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
Write a program that asks the user to enter the name of an input file. The program should read all t...
Mathematics, 11.12.2019 04:31
English, 11.12.2019 04:31
Advanced Placement (AP), 11.12.2019 04:31
Physics, 11.12.2019 04:31
Mathematics, 11.12.2019 04:31
Mathematics, 11.12.2019 04:31