+-----------------------------+ | ORIGINAL SAMPLE OUTPUT RUN: | +-----------------------------+ bash-4.1$ cat candi.txt Take10 1.25 5 A1 Ereos 1.75 3 A2 Twux 1.15 1 A3 Fratos 2.05 1 B1 Loys 1.99 4 B2 N&Ns 0.75 3 B3 -------------- bash-4.1$ python proj2.py This program simulates a vending machine. You may choose which vending machine you 'load' in, and may also specify how much money you have available for purchasing vending machine items. Please enter file to load machine from: candi.txt Please enter the amount of money you have on your card. Enter a decimal number (greater than or equal to zero): -1 The decimal number must be positive. Please try again! Enter a decimal number (greater than or equal to zero): -.000001 The decimal number must be positive. Please try again! Enter a decimal number (greater than or equal to zero): 0 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 4 Please enter the amount of money you want to add to your card. Enter a decimal number (greater than or equal to zero): 4.45 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Take10 Ereos Twux $1.25 $1.75 $1.15 A1 A2 A3 Fratos Loys N&Ns $2.05 $1.99 $0.75 B1 B2 B3 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: Twux That is not a valid choice, please try again. Please enter one of the choices from the vending machine: AA That is not a valid choice, please try again. Please enter one of the choices from the vending machine: A4 That is not a valid choice, please try again. Please enter one of the choices from the vending machine: A3 Congrats, you bought a Twux! You now have $3.3000000000000003 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Take10 Ereos {EMPTY} $1.25 $1.75 A1 A2 Fratos Loys N&Ns $2.05 $1.99 $0.75 B1 B2 B3 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: B1 Congrats, you bought a Fratos! You now have $1.2500000000000004 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Take10 Ereos {EMPTY} $1.25 $1.75 A1 A2 {EMPTY} Loys N&Ns $1.99 $0.75 B2 B3 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: B1 That is not a valid choice, please try again. Please enter one of the choices from the vending machine: A1 Congrats, you bought a Take10! You now have $4.440892098500626e-16 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Take10 Ereos {EMPTY} $1.25 $1.75 A1 A2 {EMPTY} Loys N&Ns $1.99 $0.75 B2 B3 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 5 -------------- bash-4.1$ cat candi.txt Take10 1.25 4 A1 Ereos 1.75 3 A2 Twux 1.15 0 A3 Fratos 2.05 0 B1 Loys 1.99 4 B2 N&Ns 0.75 3 B3 bash-4.1$ +-------------------------------+ | ADDITIONAL SAMPLE OUTPUT RUN: | +-------------------------------+ bash-4.1$ cat fuud.txt Cookie 0.70 5 A Pasta 1.85 3 B Milk 1.25 2 C Apple 0.95 1 D Banana 0.90 7 E Donuts 1.60 12 F Salami 2.05 6 G Cheese 5.60 9 H Soup 2.75 5 J -------------- bash-4.1$ python proj2.py This program simulates a vending machine. You may choose which vending machine you 'load' in, and may also specify how much money you have available for purchasing vending machine items. Please enter file to load machine from: fuud.txt Please enter the amount of money you have on your card. Enter a decimal number (greater than or equal to zero): 1.00 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Cookie Pasta Milk $0.7 $1.85 $1.25 A B C Apple Banana Donuts $0.95 $0.9 $1.6 D E F Salami Cheese Soup $2.05 $5.6 $2.75 G H J 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: j That is not a valid choice, please try again. Please enter one of the choices from the vending machine: J Sorry, you don't have enough money for that. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 3 You have $1.0 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 4 Please enter the amount of money you want to add to your card. Enter a decimal number (greater than or equal to zero): .5 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 3 You have $1.5 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: Milk That is not a valid choice, please try again. Please enter one of the choices from the vending machine: C Congrats, you bought a Milk! You now have $0.25 left on your card. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 1 Cookie Pasta Milk $0.7 $1.85 $1.25 A B C Apple Banana Donuts $0.95 $0.9 $1.6 D E F Salami Cheese Soup $2.05 $5.6 $2.75 G H J 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 2 Please enter one of the choices from the vending machine: A Sorry, you don't have enough money for that. 1 - Display Vending Machine 2 - Make Selection 3 - Display Card Balance 4 - Add Money to Card 5 - Quit Enter a number between 1 and 5 (inclusive): 5 -------------- bash-4.1$ cat fuud.txt Cookie 0.7 5 A Pasta 1.85 3 B Milk 1.25 1 C Apple 0.95 1 D Banana 0.9 7 E Donuts 1.6 12 F Salami 2.05 6 G Cheese 5.6 9 H Soup 2.75 5 J