SlideShare a Scribd company logo
1 of 7
Download to read offline
INTRODUCTION The goal of this programming project is to entble students practice solving a
problem that uses the Python features of functions and lists. PROBLEM Write a program that
inputs names of personal expenses and a corresponding amount for each expense. The program
should store all input data in lists. The program should present the user with a main menu to
select options to: 1. Input personal expense names 2. Input personal expense amounts 3. Display
the expenses (names and amounts) 4. Exit the program The program should then allow the user
to select how the information will be displayed from the list of: (a) pie chart (b) bar chart (c)
table. The program should achieve this in functions described below. To ensure good
programming and modularity, none of the functions should call itself and the only function calls
should be in the main function. Functions should not be defined inside other functions. At the
bottom, there should be a statement that calls the main function. No function call to main should
happen inside the main function. Here are the descriptions of what should be in the functions: 1.
main This function will have statements to call the other functions and display the main menu.
The first function called will input names of the expenses into a list and assign the list to a list
object. The second call will pass the expense items list to a function that inputs expense amounts
into a second list that is then assigned to a list object. The third call passes the two lists to a
function that will display the contents on the two lists. Here are the Python statements:
expenseItems = InputExpenseNames () expenseAmounts = InputExpenseAmounts
(expenseItems) DisplayExpenseReport (expenseItems, expenseAmounts) 2. InputExpenseNames
First create an empty list for expense items. Next, enter a loop that iterates for as long as the user
responds that there are more item names to enter. In the loop, display a message asking the user
to input the name of an expense item, then input the name and append it to the list. Then input a
response to the question whether there are more item names.
3. InputExpenseAmounts Create an empty list for expense amounts. Enter a loop that uses the
size (you may use the len function) of the expense items list to determine number of iterations.
For each iteration, display a message that says: How much was spent on xocxxoxxocx expense
item? where x x xxxxxxx is replaced by the name from the expense_items_list corresponding to
the current iteration. The amount should then be input and appended to the expense amounts list.
Input validation should be done including using try ... except ... to ensure a number was entered.
After the loop ends, return the expense amounts list. 4. DisplayExpenseReport Parameters to this
function will be the expense items and expense amounts lists. Your program should offer the
user the menu of (a) table display (b) pie chart (c) bar chart. When the user selects option (a), the
program should output column headings and then enters a loop that iterates as many times as the
size of the expense items list and outputs the contents of the lists. The program should output
some type of delineation that expenses are done and output the total of the amounts in the
expense amounts list. After exiting the loop, the program should display the totals line of the
report. Use the format function and format strings. Here is an example of what the output may
look like. When the user selects option (b), the program should output a pie chart of the data in
the lists using matplotilb. When the user selects option (c), the program should output a bar chart
of the data in the lists using matplotilib. Hint In plotting a pie chart the following did not work
for me: - pit.pie(expenseAmounts, expenseNames) It required creating and adding a parameter
between amounts and names called explode:
explodes =[] * create an explodes array for the chart for expense in expenseAmounts: explodes.
append (0.05) plt.pie(expenseAmounts, explodes, expenseNames More information can be found
at the matplotlib home site: - https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html
Your program will need to work for both User Stories below. No data Flow 1. The User runs the
program. 2. The program displays a menu asking the user if they want to: Input Expense Names,
input expense amounts, Display an expense report or quit. 3. The User selects: Display an
expense report. 4. The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble,
or return to ma. menu. 5. The User selects: Table 6. The program displays the table headings and
nothing else as there is no expense data. Th program tell the user how to get back to the reports
menu. 7. The User goes back to the reports menu. 8. The program displays a menu of expense
reports: Bar Chart, Pie Chart, Table, or return to mai. menu. 9. The User selects: Bar Chart 10.
The program displays the bar chart without any data. 11. User closes the bar chart window. 12.
The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble, or return to moin
menu. 13. The User selects: Pie Chart 14. The program displays the pie chart without any data.
15. User closes the pie chart window. 16. The program displays a menu of expense reports: Bar
Chart, Pie Chart, Table, or retum to main menu. 17. The User selects: or return to main menu.
18. The program displays a menu asking the user if they want to: input Expense Names, input
expense amounts, Display an expense report or quit. 19. The User selects, Input expense amounts
20. The program calls the function InputExpenseAmounts and returns to the main menu as there
are no expense names to get expense amounts for. 21. The program displays a menu asking the
user if they want to: Input Expense Names, input expense amounts, Display an expense report or
quit. 22. The User selects quit. Normal Flow 1. The User runs the program. 2. The program
displays a menu asking the user if they want to: Input Expense Names, input expense amounts,
Display an expense report or quit. 3. The User selects: Input Expense Names 4. The program
calls the function inputExpenseNames. 5. The program prompts the user for an expense name
and indicates how the user ends entering expense names.
6. The user enters expense name-1 7. Program stores the expense name-1 in a list 8. The user
enters expense name-2. 9. Program stores the expense name-2 in a list 10. The user indicates
they wish to go back to the main menu. 11. The program returns the list to the main program. 12.
The program displays a menu asking the user if they want to: Input Expense Names, Input
expense amounts, Display an expense report or quit. 13. The User selects, input expense amounts
14. The program calls the function InputExpenseAmounts and begins asking for amounts for
each expense, The user enters a dollar amount (22,45) for each expense name. 15. When all the
expense names have an associated amount the functi. yeturns a list of the amounts in the same
order as the names. 16. The program displays a menu asking the user if they want to: input
Expense Names, input expense amounts, Display an expense report or quit. 17. The User selects:
Display an expense report. 18. The program displays a menu of expense reports: Bar Chart, Pie
Chart, Table, or return to main menu. 19. The User selects: Table 20. The program displays the
expense report. The program tell the user how to get back to the reports menu. 21. The User goes
back to the reports menu. 22. The program displays a menu of expense reports: Bar Chart, Pie
Chart, Toble, or return to main menu. 23. The User selects: Bar Chart 24. The program displays
the bar chart. 25. User closes the bar chart window. 26. The program displays a menu of expense
reports: Bar Chart, Pie Chart, Table, or return to main menu. 27. The User selects: Pie Chart 28.
The program displays the pie chart. 29. User closes the pie chart window. 30. The program
displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 31. The
User selects: or return to main menu. 32. The program displays a menu asking the user if they
want to: Input Expense Names, Input expense amounts, Display an expense report, or quit. 33.
The User selects quit.
PROGRAM STYLE REQUIREMENTS Your program should start with several comment lines
that state your name and the purpose of the program as well as the date the program was written.
There should be a comment just before each function to state the purpose of the function and
what parameters it takes as well as what it returns. Other programmers should be able to read this
comment and know how to use the function with-out reading the code inside the function. There
should be a comment before every loop and every if statement to state what the loop/if is doing.
PROGRAM SUBMISSION REQUIREMENT Upload to Blackboard a copy of the source (.py)
file of your program. Make sure that you type the program in the IDLE editor and save before
execution. Do not type the whole program in the interactive shell. To type the program in the
editor, do the following: i) Run IDLE ii) Click on File on the main menu at the top and select
New File. A new editor window should appear iii) Type in the entire program iv) Click on File
on the main menu of the editor and select Save As ... Give your program a name in the File name
text field. Select a folder to save the program using the navigation on the left of the Save As
dialog box. Click on Save GRADING This program will be graded as follows: (** A program
that has syntax errors gets a 0/100 by default. **) (*** A program submitted in a Word or PDF
or image (photo) or ZIP/Archlve or any format that cannot be immediately run gets a 0/100, )
The goal of this programming project is to enable students practice solving a problem that uses
the Python features of functions and lists. PROBLEM Write a program that inputs names of
personol expenses and a corresponding amount for each expense The program should store all
input data in lists. The program should present the user with a main menu to select options to: 1.
Input personal expense names 2. Input personal expense amounts 3. Display the expenses (names
and amounts) 4. Exit the program The program should then allow the user to select how the
information will be displayed from the list of: (a) pie chart (b) bar chart (c) table. The program
should achieve this in functions described below. To ensure good programming and modularity,
none of the functions should call itself and the only function calls should be in the main function.
Functions should not be defined inside other functions. At the bottom, there should be a
statement that calls the main function. No function call to main should happen inside the main
function. Here are the descriptions of what should be in the functions: 1. main This function will
have statements to call the other functions and display the main menu. The first function called
will input names of the expenses into a list and assign the list to a list object. The: second call
will pass the expense items list to a function that inputs expense amounts into a second list that is
then assigned to a list object. The third call passes the two lists to a function that will display the
contents on the two lists. Here are the Python statements: expenaeltems in InputExpenseWares ()
expensehmounts = InputzipenteAnounts (axpenseitema) Displaybxpensokeport (axpenteftems,
expensetunounta) 2. InputExpenseNames First create an empty list for expense items. Next, enter
a loop that iterates for as long as the user responds that there are more item names to enter. In the
loop, display a message asking the user to input the name of an expense item, then input the
name and append it to the list. Then input a response to the question whether there are more item
names.
After the loop ends, return the expense items list. 3. InputExpenseAmounts Create an empty list
for expense amounts. Enter a loop that uses the size lyou may use the len function) of the
expense items list to determine number of iterations. For each iteration, display a message that
says: How much was spent on xococococox expense item? where xocococooo is replaced by the
name from the expense_items_list corresponding to the current iteration. The amount should
then be input and apperided to the expense amounts list. Input validation should be done
including using try ... except ... to ensure a number was entered. After the loop ends, return the
expense amounts list. 4. DisplayExpenseReport Parameters to this function will be the expense
items and expense amounts lists. Your program should offer the user the menu of (a) table
display (b) pie chart (c) bar chart: When the user selects option (a), the program should output
column headings and then enters a loop that iterates as many times as the size of the expense
items list and outputs the contents of the lists. The program should output some type of
delineation that expenses are done and output the totar of the amounts in the expense amounts
list. After exiting the loop, the program should display the totals line of the report. Use the
format function and format strings. Here is an example of what the output may look like.
TOTALS 1,186.18 When the user selects option (b), the program should output a ple chart of the
data in the lists using matplotiib. When the user selects option (c), the program should output a
bar chart of the data in the lists using matplotilb. Hint In plotting a pie chart the following did not
wark for me: - pitipiecexpenseAmounts expenseNames) It required creating and adding a
parameter between amounts and names called explode:
explodes =[1 I create an explodes array for the chart for expense in expensexmounts: explodes,
append (0.05) p1t, pie (expenselmounts, explodes, expenseNames More information can be
found at the matplotib home site: - https:llmatplotib.org/api_as_gen/matplotib.pyplot.pie.html
No data Flow 1. The User runs the program. 2. The program displays a menu asking the user if
they want to: Input Expense Names, input expense amounts, Display an expense report or quit. 3.
The User selects: Display an expense report. 4. The program displays a menu of expense reports:
Bar Chart, Ple Chart, Table, or return to moin menu. 5. The User selects: Table 6. The program
displays the table headings and nothing else as there is no expense data. The program tell the
user how to get back to the reports menu. 7. The User goes back to the reports menu. 8. The
program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to moin
menu. 9. The User selects: Bor Chart 10. The program displays the bar chart without any data.
11. User closes the bar chart window. 12. The program displays a menu of expense reports: Bar
Chart, Pie Chart, Toble, or return to main menu. 13. The User selects: Pie Chart 14. The program
displays the pie chart without any data. 15. User closes the pie chart window. 16. The program
displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 17. The
User selects or return to main menu. 18. The program displays a menu asking the user if they
want to: input Expense Names, input expense amounts, Dispiay an expense report or quit. 19.
The User selects, input expense amounts 20. The program calls the function
inputExpenseAmounts and returns to the main menu as there are no expense names to get
expense amounts for. 21. The program displays a menu asking the user if they want to: tnput
Expense Names, mpput expense amounts, Display an expense report or quit. 22. The User selects
quit. Normal Flow 1. The User runs the program. 2. The program displays a menu asking the
user if they want ro: input Expense Nomes, imput expense amounts, pisplay an expense report or
quit. 3. The User selects: input expense Names 4. The program calls the function
inputExpenseNames. 5. The program prompts the user for an expense name and indicates how
the user ends entering expense names.
b. Ihe user enters expense name-1 7. Program stores the expense name- 1 in a list 8. The user
enters expense name-2. 9. Program stores the expense name-2 in a list 10. The user indicates
they wish to go back to the main menu. 11. The program returns the list to the main program. 12.
The program displays a menu asking the user if they want to: Input Expense Names, Input
expense amounts, Display an expense report or quit. 13. The User selects, Input expense amounts
14. The program calls the function InputExpenseAmounts and begins asking for amounts for
each expense, The user enters a dollar amount (22.45) for each expense name. 15. When all the
expense names have an associated amount the function returns a list of the amounts in the same
order as the names. 16. The program displays a menu asking the user if they want to: Input
Expense Names, Input expense amounts, Display an expense report or quit. 17. The User selects:
Display an expense report. 18. The program displays a menu of expense reports: Bar Chart, Pie
Chart, Table, or return to main menu. 19. The User selects: Tabie 20. The program displays the
expense report. The program tell the user how to get back to the reports menu. 21. The User goes
back to the reports menu. 22. The program displays a menu of expense reports: Bar Chart, Pie
Chart, Table, or return to main menu. 23. The User selects: Bor Chart 24. The program displays
the bar chart. 25. User closes the bar chart window. 26. The program displays a menu of expense
reports: Bar Chart, Pie Chart, Table, or return to main menu. 27. The User selects Pie Chart 28.
The program displays the pie chart. 29. User closes the piechart window. 30. The program
displays a menu of expense reports: Bar Chant, Pie Chort, Table or return to main menu. 31. The
User selects or return to main menu. 32. The program displays a menu asking the user it they
want to: tipout Expense Names, input expense omounts, Dispiay an expense report, or quit. 33.
The User selects quir
PROGRAM STYLE REQUIREMENTS Your program should start with several comment lines
that state your name and the purpose of the program as well as the date the program was written.
There should be a comment just before each function to state the purpose of the function and
what parameters it takes as well as what it returns. Other programmers should be able to read this
commen and know how to use the function with-out reading the code inside the function. There
should be a comment before every loop and every if statement to state what the loop/if is doing:
PROGRAM SUBMISSION REQUIREMENT Upload to Blackboard a copy of the source (.py)
file of your program. Make sure that you type the program in the IDLE editor and save before
execution. Do not type the whole program in the interactive shell. To type the program in the
editor, do the following: i) Run IDLE ii) Click on File on the main menu at the top and select
New File. A new editor window should appear iii) Type in the entire program iv) Click on File
on the main menu of the editor and select Save. As ... Give your program a name in the File
name text field. Select a folder to save the program using the navigation on the left of the Save
As dialog box, Click on Save GRADING This program will be graded as follows: 4.. A proeram
submitted ina Word or POF or image (photo) or ZIP/Archive or anv format that cannot be
immedately run gets a 0/100. *)

More Related Content

Similar to Python program to input, store, and display expense data

DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfROWELL MARQUINA
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
 
The is running major errors for the other person that assisted with .pdf
The is running major errors for the other person that assisted with .pdfThe is running major errors for the other person that assisted with .pdf
The is running major errors for the other person that assisted with .pdfpreetamsahu17
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17manjurkts
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 manjurkts
 
Report exchange designer
Report exchange designerReport exchange designer
Report exchange designerrlsotto
 
Report painter in SAP
Report painter in SAPReport painter in SAP
Report painter in SAPRajeev Kumar
 
c programming 109.docx
c programming 109.docxc programming 109.docx
c programming 109.docxwrite31
 
Year 2 dsa c++ exercises on user defined functions
Year 2 dsa  c++ exercises on user defined functionsYear 2 dsa  c++ exercises on user defined functions
Year 2 dsa c++ exercises on user defined functionsErnesteNtezirizaza
 
PT1420 Modules in Flowchart and Visual Basic .docx
PT1420 Modules in Flowchart and Visual Basic             .docxPT1420 Modules in Flowchart and Visual Basic             .docx
PT1420 Modules in Flowchart and Visual Basic .docxamrit47
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Cis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comCis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comBaileyao
 
Please assist with this and use single line comment to explain each .pdf
Please assist with this and use single line comment to explain each .pdfPlease assist with this and use single line comment to explain each .pdf
Please assist with this and use single line comment to explain each .pdfagarshailenterprises
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEWshyamuopeight
 

Similar to Python program to input, store, and display expense data (18)

OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
 
DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdf
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
The is running major errors for the other person that assisted with .pdf
The is running major errors for the other person that assisted with .pdfThe is running major errors for the other person that assisted with .pdf
The is running major errors for the other person that assisted with .pdf
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
Report exchange designer
Report exchange designerReport exchange designer
Report exchange designer
 
Report painter in SAP
Report painter in SAPReport painter in SAP
Report painter in SAP
 
c programming 109.docx
c programming 109.docxc programming 109.docx
c programming 109.docx
 
Year 2 dsa c++ exercises on user defined functions
Year 2 dsa  c++ exercises on user defined functionsYear 2 dsa  c++ exercises on user defined functions
Year 2 dsa c++ exercises on user defined functions
 
Visual Logic Project - 1
Visual Logic Project - 1Visual Logic Project - 1
Visual Logic Project - 1
 
PT1420 Modules in Flowchart and Visual Basic .docx
PT1420 Modules in Flowchart and Visual Basic             .docxPT1420 Modules in Flowchart and Visual Basic             .docx
PT1420 Modules in Flowchart and Visual Basic .docx
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Cis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.comCis 170 Effective Communication / snaptutorial.com
Cis 170 Effective Communication / snaptutorial.com
 
Android menus in android-chapter15
Android menus in android-chapter15Android menus in android-chapter15
Android menus in android-chapter15
 
Please assist with this and use single line comment to explain each .pdf
Please assist with this and use single line comment to explain each .pdfPlease assist with this and use single line comment to explain each .pdf
Please assist with this and use single line comment to explain each .pdf
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
Programming Fundamental handouts
Programming Fundamental handoutsProgramming Fundamental handouts
Programming Fundamental handouts
 

More from ameancal

Introduction You will use your datasets for your project in your Unit.pdf
 Introduction You will use your datasets for your project in your Unit.pdf Introduction You will use your datasets for your project in your Unit.pdf
Introduction You will use your datasets for your project in your Unit.pdfameancal
 
Inventory Costing Methods Belden started the year with 4,500 units of.pdf
 Inventory Costing Methods Belden started the year with 4,500 units of.pdf Inventory Costing Methods Belden started the year with 4,500 units of.pdf
Inventory Costing Methods Belden started the year with 4,500 units of.pdfameancal
 
INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf
 INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf
INTRODUCTION One of the most useful and powerful plots in astrophysic.pdfameancal
 
Introduction and early history (Lectures 01 - 02) - what is animal be.pdf
 Introduction and early history (Lectures 01 - 02) - what is animal be.pdf Introduction and early history (Lectures 01 - 02) - what is animal be.pdf
Introduction and early history (Lectures 01 - 02) - what is animal be.pdfameancal
 
Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf
 Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf
Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdfameancal
 
Internet Browsers Recently, the top web browser had 51.74 of the m.pdf
 Internet Browsers Recently, the top web browser had 51.74 of the m.pdf Internet Browsers Recently, the top web browser had 51.74 of the m.pdf
Internet Browsers Recently, the top web browser had 51.74 of the m.pdfameancal
 
International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf
 International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf
International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdfameancal
 
Interest rates or discount rafes. Fill in the interest rates for the .pdf
 Interest rates or discount rafes. Fill in the interest rates for the .pdf Interest rates or discount rafes. Fill in the interest rates for the .pdf
Interest rates or discount rafes. Fill in the interest rates for the .pdfameancal
 
Internal failure costs tend to be much lower for service organization.pdf
 Internal failure costs tend to be much lower for service organization.pdf Internal failure costs tend to be much lower for service organization.pdf
Internal failure costs tend to be much lower for service organization.pdfameancal
 
Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf
 Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf
Instructions Answer ALL questions in this section. CASE STUDY Peter .pdfameancal
 
Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf
 Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf
Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdfameancal
 
Instructions Complete the following excrcises. No noed to show your .pdf
 Instructions Complete the following excrcises. No noed to show your .pdf Instructions Complete the following excrcises. No noed to show your .pdf
Instructions Complete the following excrcises. No noed to show your .pdfameancal
 
Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf
 Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf
Instructions Answer ALL questions from this section CASE STUDY Cynt.pdfameancal
 
Instructions - In Course 3 - Project Planning Putting it all togethe.pdf
 Instructions - In Course 3 - Project Planning Putting it all togethe.pdf Instructions - In Course 3 - Project Planning Putting it all togethe.pdf
Instructions - In Course 3 - Project Planning Putting it all togethe.pdfameancal
 
Instructions shares should receive under each of the following cond.pdf
 Instructions shares should receive under each of the following cond.pdf Instructions shares should receive under each of the following cond.pdf
Instructions shares should receive under each of the following cond.pdfameancal
 
Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf
 Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf
Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdfameancal
 
inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf
 inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf
inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdfameancal
 
Instructions C=200+0.75YI=150.pdf
 Instructions C=200+0.75YI=150.pdf Instructions C=200+0.75YI=150.pdf
Instructions C=200+0.75YI=150.pdfameancal
 
Instructions Submit an electronic copy of the assignment to the Drop.pdf
 Instructions Submit an electronic copy of the assignment to the Drop.pdf Instructions Submit an electronic copy of the assignment to the Drop.pdf
Instructions Submit an electronic copy of the assignment to the Drop.pdfameancal
 
Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf
 Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf
Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdfameancal
 

More from ameancal (20)

Introduction You will use your datasets for your project in your Unit.pdf
 Introduction You will use your datasets for your project in your Unit.pdf Introduction You will use your datasets for your project in your Unit.pdf
Introduction You will use your datasets for your project in your Unit.pdf
 
Inventory Costing Methods Belden started the year with 4,500 units of.pdf
 Inventory Costing Methods Belden started the year with 4,500 units of.pdf Inventory Costing Methods Belden started the year with 4,500 units of.pdf
Inventory Costing Methods Belden started the year with 4,500 units of.pdf
 
INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf
 INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf
INTRODUCTION One of the most useful and powerful plots in astrophysic.pdf
 
Introduction and early history (Lectures 01 - 02) - what is animal be.pdf
 Introduction and early history (Lectures 01 - 02) - what is animal be.pdf Introduction and early history (Lectures 01 - 02) - what is animal be.pdf
Introduction and early history (Lectures 01 - 02) - what is animal be.pdf
 
Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf
 Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf
Intipententary Integamitaty Sydem Review inl iodentind amicher flento.pdf
 
Internet Browsers Recently, the top web browser had 51.74 of the m.pdf
 Internet Browsers Recently, the top web browser had 51.74 of the m.pdf Internet Browsers Recently, the top web browser had 51.74 of the m.pdf
Internet Browsers Recently, the top web browser had 51.74 of the m.pdf
 
International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf
 International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf
International Trade Closing Cases and Discussions 1. Tadoos Sales to.pdf
 
Interest rates or discount rafes. Fill in the interest rates for the .pdf
 Interest rates or discount rafes. Fill in the interest rates for the .pdf Interest rates or discount rafes. Fill in the interest rates for the .pdf
Interest rates or discount rafes. Fill in the interest rates for the .pdf
 
Internal failure costs tend to be much lower for service organization.pdf
 Internal failure costs tend to be much lower for service organization.pdf Internal failure costs tend to be much lower for service organization.pdf
Internal failure costs tend to be much lower for service organization.pdf
 
Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf
 Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf
Instructions Answer ALL questions in this section. CASE STUDY Peter .pdf
 
Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf
 Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf
Instructions (a) Prepare a cost of goods manufactured schedule for Ju.pdf
 
Instructions Complete the following excrcises. No noed to show your .pdf
 Instructions Complete the following excrcises. No noed to show your .pdf Instructions Complete the following excrcises. No noed to show your .pdf
Instructions Complete the following excrcises. No noed to show your .pdf
 
Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf
 Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf
Instructions Answer ALL questions from this section CASE STUDY Cynt.pdf
 
Instructions - In Course 3 - Project Planning Putting it all togethe.pdf
 Instructions - In Course 3 - Project Planning Putting it all togethe.pdf Instructions - In Course 3 - Project Planning Putting it all togethe.pdf
Instructions - In Course 3 - Project Planning Putting it all togethe.pdf
 
Instructions shares should receive under each of the following cond.pdf
 Instructions shares should receive under each of the following cond.pdf Instructions shares should receive under each of the following cond.pdf
Instructions shares should receive under each of the following cond.pdf
 
Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf
 Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf
Inseructons Propane the Mery 11th� journat entry for Cody Compary.pdf
 
inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf
 inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf
inite anedt the keneth of time Alutrasweet cojoyicd its firt inover a.pdf
 
Instructions C=200+0.75YI=150.pdf
 Instructions C=200+0.75YI=150.pdf Instructions C=200+0.75YI=150.pdf
Instructions C=200+0.75YI=150.pdf
 
Instructions Submit an electronic copy of the assignment to the Drop.pdf
 Instructions Submit an electronic copy of the assignment to the Drop.pdf Instructions Submit an electronic copy of the assignment to the Drop.pdf
Instructions Submit an electronic copy of the assignment to the Drop.pdf
 
Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf
 Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf
Jaymes Inc. acquired all of haron Co.s connon stock on January 1 , 2.pdf
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 

Python program to input, store, and display expense data

  • 1. INTRODUCTION The goal of this programming project is to entble students practice solving a problem that uses the Python features of functions and lists. PROBLEM Write a program that inputs names of personal expenses and a corresponding amount for each expense. The program should store all input data in lists. The program should present the user with a main menu to select options to: 1. Input personal expense names 2. Input personal expense amounts 3. Display the expenses (names and amounts) 4. Exit the program The program should then allow the user to select how the information will be displayed from the list of: (a) pie chart (b) bar chart (c) table. The program should achieve this in functions described below. To ensure good programming and modularity, none of the functions should call itself and the only function calls should be in the main function. Functions should not be defined inside other functions. At the bottom, there should be a statement that calls the main function. No function call to main should happen inside the main function. Here are the descriptions of what should be in the functions: 1. main This function will have statements to call the other functions and display the main menu. The first function called will input names of the expenses into a list and assign the list to a list object. The second call will pass the expense items list to a function that inputs expense amounts into a second list that is then assigned to a list object. The third call passes the two lists to a function that will display the contents on the two lists. Here are the Python statements: expenseItems = InputExpenseNames () expenseAmounts = InputExpenseAmounts (expenseItems) DisplayExpenseReport (expenseItems, expenseAmounts) 2. InputExpenseNames First create an empty list for expense items. Next, enter a loop that iterates for as long as the user responds that there are more item names to enter. In the loop, display a message asking the user to input the name of an expense item, then input the name and append it to the list. Then input a response to the question whether there are more item names. 3. InputExpenseAmounts Create an empty list for expense amounts. Enter a loop that uses the size (you may use the len function) of the expense items list to determine number of iterations. For each iteration, display a message that says: How much was spent on xocxxoxxocx expense item? where x x xxxxxxx is replaced by the name from the expense_items_list corresponding to the current iteration. The amount should then be input and appended to the expense amounts list. Input validation should be done including using try ... except ... to ensure a number was entered. After the loop ends, return the expense amounts list. 4. DisplayExpenseReport Parameters to this function will be the expense items and expense amounts lists. Your program should offer the user the menu of (a) table display (b) pie chart (c) bar chart. When the user selects option (a), the program should output column headings and then enters a loop that iterates as many times as the size of the expense items list and outputs the contents of the lists. The program should output some type of delineation that expenses are done and output the total of the amounts in the
  • 2. expense amounts list. After exiting the loop, the program should display the totals line of the report. Use the format function and format strings. Here is an example of what the output may look like. When the user selects option (b), the program should output a pie chart of the data in the lists using matplotilb. When the user selects option (c), the program should output a bar chart of the data in the lists using matplotilib. Hint In plotting a pie chart the following did not work for me: - pit.pie(expenseAmounts, expenseNames) It required creating and adding a parameter between amounts and names called explode: explodes =[] * create an explodes array for the chart for expense in expenseAmounts: explodes. append (0.05) plt.pie(expenseAmounts, explodes, expenseNames More information can be found at the matplotlib home site: - https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html Your program will need to work for both User Stories below. No data Flow 1. The User runs the program. 2. The program displays a menu asking the user if they want to: Input Expense Names, input expense amounts, Display an expense report or quit. 3. The User selects: Display an expense report. 4. The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble, or return to ma. menu. 5. The User selects: Table 6. The program displays the table headings and nothing else as there is no expense data. Th program tell the user how to get back to the reports menu. 7. The User goes back to the reports menu. 8. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to mai. menu. 9. The User selects: Bar Chart 10. The program displays the bar chart without any data. 11. User closes the bar chart window. 12. The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble, or return to moin menu. 13. The User selects: Pie Chart 14. The program displays the pie chart without any data. 15. User closes the pie chart window. 16. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or retum to main menu. 17. The User selects: or return to main menu. 18. The program displays a menu asking the user if they want to: input Expense Names, input expense amounts, Display an expense report or quit. 19. The User selects, Input expense amounts 20. The program calls the function InputExpenseAmounts and returns to the main menu as there are no expense names to get expense amounts for. 21. The program displays a menu asking the user if they want to: Input Expense Names, input expense amounts, Display an expense report or quit. 22. The User selects quit. Normal Flow 1. The User runs the program. 2. The program displays a menu asking the user if they want to: Input Expense Names, input expense amounts, Display an expense report or quit. 3. The User selects: Input Expense Names 4. The program calls the function inputExpenseNames. 5. The program prompts the user for an expense name and indicates how the user ends entering expense names.
  • 3. 6. The user enters expense name-1 7. Program stores the expense name-1 in a list 8. The user enters expense name-2. 9. Program stores the expense name-2 in a list 10. The user indicates they wish to go back to the main menu. 11. The program returns the list to the main program. 12. The program displays a menu asking the user if they want to: Input Expense Names, Input expense amounts, Display an expense report or quit. 13. The User selects, input expense amounts 14. The program calls the function InputExpenseAmounts and begins asking for amounts for each expense, The user enters a dollar amount (22,45) for each expense name. 15. When all the expense names have an associated amount the functi. yeturns a list of the amounts in the same order as the names. 16. The program displays a menu asking the user if they want to: input Expense Names, input expense amounts, Display an expense report or quit. 17. The User selects: Display an expense report. 18. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 19. The User selects: Table 20. The program displays the expense report. The program tell the user how to get back to the reports menu. 21. The User goes back to the reports menu. 22. The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble, or return to main menu. 23. The User selects: Bar Chart 24. The program displays the bar chart. 25. User closes the bar chart window. 26. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 27. The User selects: Pie Chart 28. The program displays the pie chart. 29. User closes the pie chart window. 30. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 31. The User selects: or return to main menu. 32. The program displays a menu asking the user if they want to: Input Expense Names, Input expense amounts, Display an expense report, or quit. 33. The User selects quit. PROGRAM STYLE REQUIREMENTS Your program should start with several comment lines that state your name and the purpose of the program as well as the date the program was written. There should be a comment just before each function to state the purpose of the function and what parameters it takes as well as what it returns. Other programmers should be able to read this comment and know how to use the function with-out reading the code inside the function. There should be a comment before every loop and every if statement to state what the loop/if is doing. PROGRAM SUBMISSION REQUIREMENT Upload to Blackboard a copy of the source (.py) file of your program. Make sure that you type the program in the IDLE editor and save before execution. Do not type the whole program in the interactive shell. To type the program in the editor, do the following: i) Run IDLE ii) Click on File on the main menu at the top and select New File. A new editor window should appear iii) Type in the entire program iv) Click on File on the main menu of the editor and select Save As ... Give your program a name in the File name text field. Select a folder to save the program using the navigation on the left of the Save As
  • 4. dialog box. Click on Save GRADING This program will be graded as follows: (** A program that has syntax errors gets a 0/100 by default. **) (*** A program submitted in a Word or PDF or image (photo) or ZIP/Archlve or any format that cannot be immediately run gets a 0/100, ) The goal of this programming project is to enable students practice solving a problem that uses the Python features of functions and lists. PROBLEM Write a program that inputs names of personol expenses and a corresponding amount for each expense The program should store all input data in lists. The program should present the user with a main menu to select options to: 1. Input personal expense names 2. Input personal expense amounts 3. Display the expenses (names and amounts) 4. Exit the program The program should then allow the user to select how the information will be displayed from the list of: (a) pie chart (b) bar chart (c) table. The program should achieve this in functions described below. To ensure good programming and modularity, none of the functions should call itself and the only function calls should be in the main function. Functions should not be defined inside other functions. At the bottom, there should be a statement that calls the main function. No function call to main should happen inside the main function. Here are the descriptions of what should be in the functions: 1. main This function will have statements to call the other functions and display the main menu. The first function called will input names of the expenses into a list and assign the list to a list object. The: second call will pass the expense items list to a function that inputs expense amounts into a second list that is then assigned to a list object. The third call passes the two lists to a function that will display the contents on the two lists. Here are the Python statements: expenaeltems in InputExpenseWares () expensehmounts = InputzipenteAnounts (axpenseitema) Displaybxpensokeport (axpenteftems, expensetunounta) 2. InputExpenseNames First create an empty list for expense items. Next, enter a loop that iterates for as long as the user responds that there are more item names to enter. In the loop, display a message asking the user to input the name of an expense item, then input the name and append it to the list. Then input a response to the question whether there are more item names. After the loop ends, return the expense items list. 3. InputExpenseAmounts Create an empty list for expense amounts. Enter a loop that uses the size lyou may use the len function) of the expense items list to determine number of iterations. For each iteration, display a message that says: How much was spent on xococococox expense item? where xocococooo is replaced by the name from the expense_items_list corresponding to the current iteration. The amount should then be input and apperided to the expense amounts list. Input validation should be done including using try ... except ... to ensure a number was entered. After the loop ends, return the expense amounts list. 4. DisplayExpenseReport Parameters to this function will be the expense
  • 5. items and expense amounts lists. Your program should offer the user the menu of (a) table display (b) pie chart (c) bar chart: When the user selects option (a), the program should output column headings and then enters a loop that iterates as many times as the size of the expense items list and outputs the contents of the lists. The program should output some type of delineation that expenses are done and output the totar of the amounts in the expense amounts list. After exiting the loop, the program should display the totals line of the report. Use the format function and format strings. Here is an example of what the output may look like. TOTALS 1,186.18 When the user selects option (b), the program should output a ple chart of the data in the lists using matplotiib. When the user selects option (c), the program should output a bar chart of the data in the lists using matplotilb. Hint In plotting a pie chart the following did not wark for me: - pitipiecexpenseAmounts expenseNames) It required creating and adding a parameter between amounts and names called explode: explodes =[1 I create an explodes array for the chart for expense in expensexmounts: explodes, append (0.05) p1t, pie (expenselmounts, explodes, expenseNames More information can be found at the matplotib home site: - https:llmatplotib.org/api_as_gen/matplotib.pyplot.pie.html No data Flow 1. The User runs the program. 2. The program displays a menu asking the user if they want to: Input Expense Names, input expense amounts, Display an expense report or quit. 3. The User selects: Display an expense report. 4. The program displays a menu of expense reports: Bar Chart, Ple Chart, Table, or return to moin menu. 5. The User selects: Table 6. The program displays the table headings and nothing else as there is no expense data. The program tell the user how to get back to the reports menu. 7. The User goes back to the reports menu. 8. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to moin menu. 9. The User selects: Bor Chart 10. The program displays the bar chart without any data. 11. User closes the bar chart window. 12. The program displays a menu of expense reports: Bar Chart, Pie Chart, Toble, or return to main menu. 13. The User selects: Pie Chart 14. The program displays the pie chart without any data. 15. User closes the pie chart window. 16. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 17. The User selects or return to main menu. 18. The program displays a menu asking the user if they want to: input Expense Names, input expense amounts, Dispiay an expense report or quit. 19. The User selects, input expense amounts 20. The program calls the function inputExpenseAmounts and returns to the main menu as there are no expense names to get expense amounts for. 21. The program displays a menu asking the user if they want to: tnput Expense Names, mpput expense amounts, Display an expense report or quit. 22. The User selects quit. Normal Flow 1. The User runs the program. 2. The program displays a menu asking the
  • 6. user if they want ro: input Expense Nomes, imput expense amounts, pisplay an expense report or quit. 3. The User selects: input expense Names 4. The program calls the function inputExpenseNames. 5. The program prompts the user for an expense name and indicates how the user ends entering expense names. b. Ihe user enters expense name-1 7. Program stores the expense name- 1 in a list 8. The user enters expense name-2. 9. Program stores the expense name-2 in a list 10. The user indicates they wish to go back to the main menu. 11. The program returns the list to the main program. 12. The program displays a menu asking the user if they want to: Input Expense Names, Input expense amounts, Display an expense report or quit. 13. The User selects, Input expense amounts 14. The program calls the function InputExpenseAmounts and begins asking for amounts for each expense, The user enters a dollar amount (22.45) for each expense name. 15. When all the expense names have an associated amount the function returns a list of the amounts in the same order as the names. 16. The program displays a menu asking the user if they want to: Input Expense Names, Input expense amounts, Display an expense report or quit. 17. The User selects: Display an expense report. 18. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 19. The User selects: Tabie 20. The program displays the expense report. The program tell the user how to get back to the reports menu. 21. The User goes back to the reports menu. 22. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 23. The User selects: Bor Chart 24. The program displays the bar chart. 25. User closes the bar chart window. 26. The program displays a menu of expense reports: Bar Chart, Pie Chart, Table, or return to main menu. 27. The User selects Pie Chart 28. The program displays the pie chart. 29. User closes the piechart window. 30. The program displays a menu of expense reports: Bar Chant, Pie Chort, Table or return to main menu. 31. The User selects or return to main menu. 32. The program displays a menu asking the user it they want to: tipout Expense Names, input expense omounts, Dispiay an expense report, or quit. 33. The User selects quir PROGRAM STYLE REQUIREMENTS Your program should start with several comment lines that state your name and the purpose of the program as well as the date the program was written. There should be a comment just before each function to state the purpose of the function and what parameters it takes as well as what it returns. Other programmers should be able to read this commen and know how to use the function with-out reading the code inside the function. There should be a comment before every loop and every if statement to state what the loop/if is doing: PROGRAM SUBMISSION REQUIREMENT Upload to Blackboard a copy of the source (.py) file of your program. Make sure that you type the program in the IDLE editor and save before
  • 7. execution. Do not type the whole program in the interactive shell. To type the program in the editor, do the following: i) Run IDLE ii) Click on File on the main menu at the top and select New File. A new editor window should appear iii) Type in the entire program iv) Click on File on the main menu of the editor and select Save. As ... Give your program a name in the File name text field. Select a folder to save the program using the navigation on the left of the Save As dialog box, Click on Save GRADING This program will be graded as follows: 4.. A proeram submitted ina Word or POF or image (photo) or ZIP/Archive or anv format that cannot be immedately run gets a 0/100. *)