Question: Python Program name: Functionalized Sales Report In an effort to improve on your sales report program, Mr. Mainway requests that you code using functions for
Python
Program name: Functionalized Sales Report
In an effort to improve on your sales report program, Mr. Mainway requests that you code using functions for all of the processing. Your program should have a main() function that controls the processing of the program, as well as a function for each of the jobs/tasks the program needs to perform.
Pseudocode
| none | Display Enter month of the report Input month Display Enter year of the report Input year
NY_sales = get_sales(New York) #Repeat the above for each state
total_sales = NY_sales + #sales for each state
NY_percent = find_percent(NY_sales, total_sales) #Repeat the above for each state
total_percent = NY_percent + #percent for each state
NY_bonus = find_bonus(NY_sales, NY_percent) #Repeat the above for each state
total_bonus = NY_bonus + #bonus for each state
display_report_header(month, year)
display_detail_line(New_York, NY_sales, NY_percent, NY_bonus) #Repeat the above for each state
display_report_totals(total_sale, total_percent, total_bonus) | none |
| get_sales() | ||
| Input | Processing | Output |
| state_name | state_total = 0 store_count = 1
sales = get_valid_amt(state_name, store_count) #priming read
while sales != SENTINEL state_total += sales store_count += 1 sales = get_valid_sales(state_name, store_count) #loop read
return state_total | state_total |
| get_valid_amt() | ||
| Input | Processing | Output |
| s_name count | good_data = False
while not good_data display Input total sale for , s_name, store, count input amt good_data = MIN <= amt <= MAX or amt = SENTINEL if not good_data display Invalid sales amount
return amt | amt |
| find_percent() | ||
| Input | Processing | Output |
| sales total_sales | return sales/total_sales | sales/total_sales |
| find_bonus() | ||
| Input | Processing | Output |
| sales percent | if percent <= 0.10 return sales * 0.01 else if percent <= 0.20 return sales * 0.03 else if percent <= 0.30 return sales * 0.05 else return sales * 0.08 | sales*rate |
| display_report_header() | ||
| Input | Processing | Output |
| Month year | Display Irwin Mainway Toy Company Total Sales Report Display For the Month of, month, year Display State Total Sales Percent of Total Bonus Amount Display =======================================
| none |
| display_detail_line() | ||
| Input | Processing | Output |
| name sales percent bonus | Display name, sales, percent, bonus | none |
| display_report_totals() | ||
| Input | Processing | Output |
| t_sales t_percent t_bonus | Display ------------------------------------------ Display Totals, t_sales, t_percent, t_bonus | none |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
