subject

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
Primary tech skills are skills that are necessary for success in online education
Answers: 3
question
Computers and Technology, 24.06.2019 11:00
Why is it uncommon for users to perform searches directly in database tables? a.)users are discouraged from interacting directly with tables because they might confuse tables with spreadsheets. b.) users are discouraged from interacting directly with tables because this may result in unintended changes to source data. c.)users do not have the technical skills required to perform searches directly in database tables. d.)users do not have the permissions required to perform searches directly in database tables.
Answers: 1
question
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her age and assigns the user’s input to an integer variable named age.
Answers: 1
You know the right answer?
Write a program that asks the user to enter the name of an input file. The program should read all t...
Questions
question
Social Studies, 08.10.2019 06:10
question
Mathematics, 08.10.2019 06:10
question
English, 08.10.2019 06:20
question
Mathematics, 08.10.2019 06:20
Questions on the website: 13722361