Question: You have been asked to write a program to help the sales manager process and summarize the sales data for their salespeople. You will need

You have been asked to write a program to help the sales manager process and summarize the sales data for their salespeople. You will need to ask the user for the filename of the sales data file. You are being provided a file to test with, named sales. txt. Each line of the file is the amount of a single sales transaction.
This is not the file your instructor will use to test your program. It is provided to help you test. You should build a solution that should account for a file with any number of lines and different values. No hard-coding!
Your program must:
Display messages where appropriate to inform the user what is happening
Implement a TRY/EXCEPT block to ask and check for a valid, existing filename in the current folder.
if a filename IS NOT found, re-ask the user for the filename until one is found.
Read the sales file line-by-line, individually (readline function)
Calculate the number of sales transactions (number of lines)
Calculate the total sales (sum of all lines)
Calculate'the average order value (average of all the lines)
Use FLOATING POINT for your sales variables.
Display all sales monetary output in CURRENCY format (2 decimal positions) and $ symbols.
Report Number of sales, average sale price, and total value of sales.
Additionally:
Use a main() function for your entire program
Write a function named get_average() to calculate the average order value
It should accept two parameters - total sales and number of transactions
It should return the value as a float (not formatted) to the program line which called it
Presume all data in the file is numeric as stated
Software Requirements for BOTH PARTS:
Use comments at the top of your program to indicate your name, name of your program and a short description of what the program does
Store any values used in calculations as variables or named constants
All output should use F-Strings only
No calculations inside output statements
Comment the meaning of all variables and functions when they are created
All input requests should be user-friendly with correct grammar and spacing before the input area
Format all numerical output in appropriate formats (use integer or decimal with appropriate places)
Do not use global variables! This also means no variables outside of main()!
If you write a function, you must pass the required values into your function and use a return statement to return the appropriate value(s) back to the line of your program that called the function
You have been asked to write a program to help the sales manager process and summarize the sales data for their salespeople. You will need to ask the user for the filename of the sales data file. You are being provided a file to test with, named sales. txt. Each line of the file is the amount of a single sales transaction.
This is not the file your instructor will use to test your program. It is provided to help you test. You should build a solution that should account for a file with any number of lines and different values. No hard-coding!
Your program must:
Display messages where appropriate to inform the user what is happening
Implement a TRY/EXCEPT block to ask and check for a valid, existing filename in the current folder.
if a filename IS NOT found, re-ark the user for the filename until one is found.
Read the sales file line-by-line, individually (readline function)
Calculate the number of sales transactions (number of lines)
Calculate the total sales (sum of all lines)
Calculate the average order value (average of all the lines)
Use FLOATING POINT for your sales variables.
Display all sales monetary output in CURRENCY format (2 decimal positions) and $ symbols.
Report Number of sales, average sale price, and total value of sales.
Additionally:
Use a main () function for your entire program
Write a function named get_average() to calculate the average order value
It should accept two parameters - total sales and number of transactions
It should return the value as a float (not formatted) to the program line which called it
Presume all data in the file is numeric as stated
Software Requirements for BOTH PARTS:
Use comments at the top of your program to indicate your name, name of your program and a short description of what the program does
Store any values used in calculations as variables or named constants
All output should use F-Strings only
No calculations inside output statements
Comment the meaning of all variables and functions when they are created
All input requests should be user-friendly with correct grammar and spacing before the input area
Format all numerical output in appropriate formats (use integer or decimal with appropriate places)
Do not use global variables! This also means no variables outside of main()!
If you write a function, you must pass the required values into your function and use a return statement to return the appropriate value(s) back to the line of your program that called the function
You have been asked to write a program to help

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 Programming Questions!