Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please code in python. Chapter 07 Monthly Sales Create a program that reads the sales for 12 months from a file and displays 12 months

please code in python.

image text in transcribedimage text in transcribed

Chapter 07 Monthly Sales Create a program that reads the sales for 12 months from a file and displays 12 months of sales data, calculates the total yearly sales and average monthly sales, and allows the user to edit the sales for any month. The chapter 6 program will be the foundation for this program which will add the TO functionality. Console Monthly sales program COMMAND MENU monthly - View monthly sales yearly - View yearly summary edit - Edit sales for a month exit - Exit program Command: monthly Jan - 616 Feb - 466 Mar - 796 Apr - 238 May - 310 Jun - 726 Jul - 987 Aug - 604 Sep - 951 Oct - 958 Nov - 238 Dec - 610 Command: yearly Yearly total: Monthly average: 7500 625 Command: edit Three-letter Month: Noc Invalid three-letter month Command: edit Three-letter Month: Nov Sales Amount: 354 Sales amount for Nov was modified. Command: exit Bye! . . Specifications Use the CSV file named monthly sales.csv that contains the month and sales data shown above. Write a function to open and read the CSV file. This function will not have a parameter. Each row in the file will be turned into a list that holds the month and sales value for the month. Each row list will be added to a list that is returned by the function. Create a function that saves the monthly sales list to the CSV file. This function will take a list as a parameter. Create functions for the monthly, yearly, and edit commands. The functions will take the sales list as an input parameter. Call each function from an if statement in the main method. The main method will call the function that reads the file to store the list of lists in the monthly sales list. The edit function will call the function that writes to the CSV file immediately after any change to the list are completed. The yearly function will dynamically calculate the average based on the total of all sales values in the list and the length of the list. Round the results of the monthly average to a maximum of 2 decimal digits. Formatting is not required. The edit function will ask the user for the three-letter month and sales value and make a simple list of these two values. This simple new list will replace the current single month list in the sales list. For the edit function, display an error message if the user doesn't enter a valid three-letter abbreviation for the month. Use the following list as the standard abbreviations. months = ['Jan', 'Feb', 'Mar', 'Apr, 'May', 'Jun', Jul', 'Aug', 'Sep', 'Oct", "Nov', 'Dec'] . . Chapter 07 Monthly Sales Create a program that reads the sales for 12 months from a file and displays 12 months of sales data, calculates the total yearly sales and average monthly sales, and allows the user to edit the sales for any month. The chapter 6 program will be the foundation for this program which will add the TO functionality. Console Monthly sales program COMMAND MENU monthly - View monthly sales yearly - View yearly summary edit - Edit sales for a month exit - Exit program Command: monthly Jan - 616 Feb - 466 Mar - 796 Apr - 238 May - 310 Jun - 726 Jul - 987 Aug - 604 Sep - 951 Oct - 958 Nov - 238 Dec - 610 Command: yearly Yearly total: Monthly average: 7500 625 Command: edit Three-letter Month: Noc Invalid three-letter month Command: edit Three-letter Month: Nov Sales Amount: 354 Sales amount for Nov was modified. Command: exit Bye! . . Specifications Use the CSV file named monthly sales.csv that contains the month and sales data shown above. Write a function to open and read the CSV file. This function will not have a parameter. Each row in the file will be turned into a list that holds the month and sales value for the month. Each row list will be added to a list that is returned by the function. Create a function that saves the monthly sales list to the CSV file. This function will take a list as a parameter. Create functions for the monthly, yearly, and edit commands. The functions will take the sales list as an input parameter. Call each function from an if statement in the main method. The main method will call the function that reads the file to store the list of lists in the monthly sales list. The edit function will call the function that writes to the CSV file immediately after any change to the list are completed. The yearly function will dynamically calculate the average based on the total of all sales values in the list and the length of the list. Round the results of the monthly average to a maximum of 2 decimal digits. Formatting is not required. The edit function will ask the user for the three-letter month and sales value and make a simple list of these two values. This simple new list will replace the current single month list in the sales list. For the edit function, display an error message if the user doesn't enter a valid three-letter abbreviation for the month. Use the following list as the standard abbreviations. months = ['Jan', 'Feb', 'Mar', 'Apr, 'May', 'Jun', Jul', 'Aug', 'Sep', 'Oct", "Nov', 'Dec']

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+7. What is its position?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago