programming project [spring 2021]: vending machine · 2021. 4. 27. · programming project: vending...

7
Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade) and must be completed and turned in by Sunday, April 25, 2021 before 11:59pm. Assignment Overview: You will create a vending machine program in Python that sells at least 5 items of your choice. This assignment will give you more experience on the use of: 1. integers (int) 2. floats (float) 3. Strings, output formatting (str) 4. conditionals 5. iteration 6. data structures (lists, dictionaries) 7. functions You will write a program that prompts a user to select items from your vending machine with a menu. The user can select as many items as they would like and your program should calculate their purchase total including a subtotal and the appropriate sales tax for your state. As a user selects items from the vending machine, you should display an updated shopping cart. After displaying the total, your program should then allow the user to enter a payment in whole dollars. Your program will then calculate and dispense the correct amount of change and a receipt. Your vending machine should have a catchy name and a theme. Project Description/Specification: This program can be broken down incrementally. Weekly milestones have been organized below. You should be able to extend your project each week with the same program file. Your program must meet the following specifications: Week 1 [March 15-21] (Algorithm Development) 1. Complete the Algorithm Development Worksheet a. Your algorithm should capture your input, process, and output thoroughly. b. Feel free to include any pen/paper illustrations that aid in the development of your algorithm

Upload: others

Post on 12-Aug-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

Programming Project: Vending Machine Project

This assignment is worth 120 points (15% of your course grade) and must be completedand turned in by Sunday, April 25, 2021 before 11:59pm.

Assignment Overview:You will create a vending machine program in Python that sells at least 5 items of yourchoice.

This assignment will give you more experience on the use of:1. integers (int)2. floats (float)3. Strings, output formatting (str)4. conditionals5. iteration6. data structures (lists, dictionaries)7. functions

You will write a program that prompts a user to select items from your vending machinewith a menu. The user can select as many items as they would like and your programshould calculate their purchase total including a subtotal and the appropriate sales taxfor your state. As a user selects items from the vending machine, you should display anupdated shopping cart. After displaying the total, your program should then allow theuser to enter a payment in whole dollars. Your program will then calculate and dispensethe correct amount of change and a receipt. Your vending machine should have acatchy name and a theme.

Project Description/Specification:This program can be broken down incrementally. Weekly milestones have beenorganized below. You should be able to extend your project each week with the sameprogram file.

Your program must meet the following specifications:Week 1 [March 15-21] (Algorithm Development)

1. Complete the Algorithm Development Worksheeta. Your algorithm should capture your input, process, and output thoroughly.b. Feel free to include any pen/paper illustrations that aid in the development

of your algorithm

Page 2: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

2. Deliverable: Use the submission link in Moodle to submit by Sunday, March 28,11:59am. Please submit the .pdf file provided.

Week 2 [March 22-28](Print menu and take a selection)1. At program start, you will print a menu with the contents of your vending

machine.a. Customize your own vending machine with items of your interestb. Your vending machine should have at least 5 items

2. Accept items to be purchased, or until a sentinel value is entered.a. Print the selected item after each selection.

3. Deliverable: Use submission link in Moodle to submit your working .py Pythonprogram file. You should not submit any other file format. Submissions due:Sunday, April 4, 11:59pm

Week 3 [March 29-April 4](Take many selections, calculate total, and acceptpayment)

4. Extend your code to allow users to repeatedly select items for purchase andkeep a running subtotal

a. Your menu should contain a sentinel value for the user to select checkoutas an option to finish shopping.

b. Check that the selection entered is an option of the menu. If not, then printan error message and start over requesting a new selection or to quit.

5. Calculate amount due with subtotal + sales tax (for your state).6. Accept payment in whole dollars7. Following the deposit (payment), calculate change due (difference between

payment and amount due)8. Deliverable: Use submission link in Moodle to submit your working .py Python

program file. You should not submit any other file format. Submissions due:Sunday, April 11, 11:59pm

Week 4 [April 5-11](Dispense change)9. Extend your code to determine the dollars and coins to be dispensed from the

change due or as a refund. This calculation will depend on the paymentaccepted. For example, if the user selected items totaling $10.35 and they onlydeposit $7.00, they have provided insufficient payment.

a. Check that the payment received is greater than or equal to the amountdue. If the payment is less than the amount due, then print an errormessage and prompt the user to enter sufficient funds. If the payment isequal to the amount due, then print a message saying “No change due.”

Page 3: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

b. Print the number of dollars and coins to be dispensed and theirdenominations.

10.Deliverable: Use submission link in Moodle to submit your working .py Pythonprogram file. You should not submit any other file format. Submissions due:Sunday, April 18, 11:59pm

Week 5 [April 12-18](Incorporating functions)11. Extend your code to include the following functions,

a. print_menu(): non-value returning function to print out the menu at thestart of the program and after each item for purchase is chosen. Thismenu should contain a sentinel for the user to checkout when the user isfinished selecting items.

b. get_item_price(new_item): a value returning function that returns an item’sprice

c. make_change(change_due): (previous lab assignment): Calculate theusers change (“Here is your change: “) in dollars and coins and print aclosing message (“Have a great day”).

d. amount_due(total_price): a value returning function that prints a subtotaland final total that includes sales tax (for your state) added to the total.This function will also require the user to input a whole dollar amount forpayment and return the amount of change due and should prompt theuser to retry if too little cash is paid.

Notes and Hints:● You should also make use of a container to store your items with prices (I.e.

Dictionaries, lists).● You should clearly and thoughtfully design your output. Start with an algorithm

first, thoroughly flesh out your plan and solution and then begin your program.● Creativity counts! You can sell anything...beats, art, food, clothing, weave,

affirmations, greeting cards, craft items, flower bouquets, poetry, advice, jokes.Sky’s the limit.

Final Deliverables [Due: April 25, 2021 @ 11:59pm]:1. [Worth 100pts] Your Python program file (student_name_proj2.py)

a. This will be uploaded to Moodle.b. You can also include your algorithm in the program file. This algorithm

may be slightly different than your first submission as you may haverefined or added additional details.

Page 4: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

2. [Worth 20pts] A short Powerpoint presentation or FlipGrid video (5 slides or less,5 minutes video or less; either format should be longer than 5 minutes).

a. You should research the cost of items you are selling and present yourvending machine. Cover the following topics:

i. Your name and your vending machine (with a mockup, examplebelow)

ii. Items for Sale (with pictures, see below)

iii. An algorithmiv. Screenshots of sample code output from your vending machine

(see below, my sample output)v. Reflections on the programming challenge

1. Why did you choose your particular items?2. Brief description of how you determined the value for your

items3. Any other creative details you’d like to share

Page 5: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

Sample Output:

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Welcome to Andrea's Sweet Treats Cafe*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-PLEASE SELECT FROM THE FOLLOWING MENU :A: Dark Chocolate Lava Cake - $7.50B: Cacao Nibs in Peanut Caramel Brittle - $5C: Apple Pie - $15.75D: Ooey Gooey Chocolate Chip Cookies (dozen cookies) - $12E: Lemon Pound Cake - $10F: FINISHED SHOPPING - CHECKOUT*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Selection: a

Here are your items thus far:---------------------------------------------------------------------------(1) Dark Chocolate Lava Cake @ $7.50 per dessert---------------------------------------------------------------------------Total: 7.50

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Welcome to Andrea's Sweet Treats Cafe*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-PLEASE SELECT FROM THE FOLLOWING MENU :A: Dark Chocolate Lava Cake - $7.50B: Cacao Nibs in Peanut Caramel Brittle - $5C: Apple Pie - $15.75D: Ooey Gooey Chocolate Chip Cookies (dozen cookies) - $12E: Lemon Pound Cake - $10F: FINISHED SHOPPING - CHECKOUT*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Selection: c

Here are your items thus far:---------------------------------------------------------------------------(1) Dark Chocolate Lava Cake @ $7.50 per dessert(1) Apple Pie @ $15.75 per dessert---------------------------------------------------------------------------Total: 23.25

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Welcome to Andrea's Sweet Treats Cafe*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-PLEASE SELECT FROM THE FOLLOWING MENU :A: Dark Chocolate Lava Cake - $7.50B: Cacao Nibs in Peanut Caramel Brittle - $5

Page 6: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

C: Apple Pie - $15.75D: Ooey Gooey Chocolate Chip Cookies (dozen cookies) - $12E: Lemon Pound Cake - $10F: FINISHED SHOPPING - CHECKOUT*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Selection: c

Here are your items thus far:---------------------------------------------------------------------------(1) Dark Chocolate Lava Cake @ $7.50 per dessert(2) Apple Pie @ $15.75 per dessert---------------------------------------------------------------------------Total: 39.00

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Welcome to Andrea's Sweet Treats Cafe*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-PLEASE SELECT FROM THE FOLLOWING MENU :A: Dark Chocolate Lava Cake - $7.50B: Cacao Nibs in Peanut Caramel Brittle - $5C: Apple Pie - $15.75D: Ooey Gooey Chocolate Chip Cookies (dozen cookies) - $12E: Lemon Pound Cake - $10F: FINISHED SHOPPING - CHECKOUT*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Selection: e

Here are your items thus far:---------------------------------------------------------------------------(1) Dark Chocolate Lava Cake @ $7.50 per dessert(2) Apple Pie @ $15.75 per dessert(1) Lemon Pound Cake @ $10.00 per dessert---------------------------------------------------------------------------Total: 49.00

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Welcome to Andrea's Sweet Treats Cafe*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-PLEASE SELECT FROM THE FOLLOWING MENU :A: Dark Chocolate Lava Cake - $7.50B: Cacao Nibs in Peanut Caramel Brittle - $5C: Apple Pie - $15.75D: Ooey Gooey Chocolate Chip Cookies (dozen cookies) - $12E: Lemon Pound Cake - $10F: FINISHED SHOPPING - CHECKOUT*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-Selection: f-----------------------------YOUR SHOPPING BAG-----------------------------

Page 7: Programming Project [Spring 2021]: Vending Machine · 2021. 4. 27. · Programming Project: Vending Machine Project This assignment is worth 120 points (15% of your course grade)

---------------------------------------------------------------------------(1) Dark Chocolate Lava Cake @ $7.50 per dessert(2) Apple Pie @ $15.75 per dessert(1) Lemon Pound Cake @ $10.00 per dessert---------------------------------------------------------------------------SUBTOTAL $ 49.00TAX $ 2.45

TOTAL DUE $ 51.45

Please enter your payment in whole dollars: 65----------------------------Here's your change:----------------------------$13.5513 Dollars2 Quarters4 Pennies*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

THANKS FOR SHOPPING WITH USvisit our website for updated inventory announcements

www.sweettreats.com