Objective: Working with control statements, iteration structures, data structures & functions Create one .py source file. Tasks
Question:
Objective:
Working with control statements, iteration structures, data structures & functions Create one .py source file.
Tasks
Task 1 (30 marks)
You are going to create an application that allows a user to budget their expenses.
1) Create a python file named assignment1_DDDDDDDDD, where DDDDDDDDD represents your
student number (-1 mark complete)
2) Add your full name as a comment. (-1 mark complete)
3) Add your student number as a comment. (-1 mark complete)
4) Ask the user how much income they make per (Your choice of second, minute, hour, daily, weekly,
bi-weekly, trimester, or semi-annual. Notice that monthly and annually are NOT part of the list of
options). Allow whole or decimal numbers (2 marks)
5) Convert the value above to an annual income. (1 mark)
a) Store this value.
b) Output this value to screen.
COURSE NAME: Intro to Programming COURSE CODE: COMP1250
PAGE: 1
6) Convert the value above to a monthly income. (1 mark) a) Store this value but do not output it.
7) Continually ask the user to input their expenses until they have surpassed their monthly income budget (3 marks)
a) Each time you ask the user for an expense, store the name, quantity, total price, and category of
the expense. (2 marks)
b) Only accept 5 of the many categories listed on this page:
https://mint.intuit.com/mint-categories/
(2 marks)
c) Stop asking the user to list their expenses if and only if either of these cases occur
i) The user inputs an expense name shorter than 3 characters
ii) The user inputs an expense quantity less than 1
iii) The user inputs an expense total price less than 1 cent.
iv) The user inputs a category that is not one of your five accepted categories.
d) Use a custom-made function to validate EACH of the conditions above. There should be 4 functions with unique names called to ensure the conditions above are met. (4 marks)
8) If the user adds a duplicate entry of expense name and expense category, ignore the entry.
(2 marks)
Marks for data structure(s) used to store expenses: 5 marks
9) Output to screen all the expenses from each category. Output the data in any way desired.
(3 marks)
10) Output all unique expense names. (1 mark)
11) Output all expense names that share the same value of quantity for all five categories. (2 marks)
12) Output all expense names that have a total price of less than X dollars. You choose any value for X.
(1 mark)
13) Output all expense names that have a total price of greater than Y dollars. You choose any value for Y. (1 mark)
Business and Administrative Communication
ISBN: 978-0073403182
10th edition
Authors: Kitty o. locker, Donna s. kienzler