Project Description
Create a program that allows the user to view and edit the sales amounts for each month of the current year.
Sample Run
Product Sales Management System
Command Menu
view - View a sales amount for a specified month
highest - View the highest sales of the year
lowest - View the lowest sales of the year
edit - Edit a sales amount for a specified month
average - View the sales average for the whole year
range - View the sales average for a specified sales amount range
total - View the sales total for the whole year
exit - Exit the program
Command: new
Invalid command. Try again.
Command: view
Three-letter month: jan
Sales amount for Jan is $14,317.00
Command: highest
The highest sales amount is $15,578.00 in Aug
Command: lowest
The lowest sales amount is $88.00 in Nov
Command: edit
Three-letter month: jan
Sales amount: 15293
Sales amount of $15,293.00 for Jan has been updated
Command: average
Monthly average is $5,775.55
Command: range
Low: 2540
Hi: 8755
Sales average of this range is $4,791.33
Command: total
Yearly total is $63,531.00
Command: view
Three-letter month: july
Invalid three-letter month. Try again
Command: exit
Thank you for using my app!
Specifications
In your program, use this text file: monthly_sales.txt that consists of rows that contain three-letter abbreviations for the month and the monthly sales.
The program should read the file and store the sales data for each month in a dictionary with the month abbreviation as the key for each item.
Whenever the sales data is edited, the program should write the updated data to the text file.
The program should display error messages for invalid user inputs.
Use the format function to display your outputs when needed. For instance, if the month is Jan and the amount is 14317, "Sales amount for Jan is $14,317.00." is implemented as follows:
print("Sales amount for {:s} is ${:,.2f}.".format(month, amount))
{:s} is a string format parameter for the month.
{:,.2f} is a float number format parameter for the amount with 2 decimal places.
Note that you are required to define one function for each command including the "exit" command in your program.
Your program should define the following functions in Project4.py (module files not required):
read_file() - This function should return a dictionary which contains all data from the text file.
write_file(dictionary)
view_sales_amount(dictionary)
get_highest_amount(dictionary)
get_lowest_amountt(dictionary)
edit_sales_amount(dictionary)
get_average(dictionary)
get_range_average(dictionary)
get_total(dictionary)
terminate_app()
main()
monthly_sales.txt