Need help with question. Sample output below. Coding language is python. Copy your solution from the question 1 into a new file and name it a2_q2.py. You must not overwrite your previous solution; the marking TA will want to see both files. You will add code to this new file (a2_q2.py) that allows the following functionalities. The user (customer) can now view the e-list to select items for purchase. They should be able to select the items by entering the corresponding number from the list. Again, invalid selections should be handled with suitable error messages and the list should be repeated (see sample outputs below). Once the customer has selected a product, the program should ask how many of that product the customer would like to buy. Your program must make sure that selected products are available in stock, otherwise it should generate error messages and the menu should be repeated. After every valid selection is made, the current total should be printed, and the stock should be updated on the e-list (see sample outputs below). When the user completes product selection (i.e., enters 4), it should provide the user with their receipt. The receipt must show (a) the subtotal, (b) tax amount (13% of the subtotal) and (c) the total cost of the purchase. See sample outputs below.
Need help with question. Sample output below. Coding language is python.
Copy your solution from the question 1 into a new file and name it a2_q2.py. You must not overwrite your previous solution; the marking TA will want to see both files. You will add code to this new file (a2_q2.py) that allows the following functionalities. The user (customer) can now view the e-list to select items for purchase.
They should be able to select the items by entering the corresponding number from the list. Again, invalid selections should be handled with suitable error messages and the list should be repeated (see sample
outputs below). Once the customer has selected a product, the program should ask how many of that product the customer would like to buy. Your program must make sure that selected products are available in stock, otherwise it should generate error messages and the menu should
be repeated. After every valid selection is made, the current total should be printed, and the stock should be updated on the e-list (see sample outputs below).
When the user completes product selection (i.e., enters 4), it should provide the user with their
receipt. The receipt must show (a) the subtotal, (b) tax amount (13% of the subtotal) and (c) the
total cost of the purchase. See sample outputs below.
Sample output (how it should look like):
Please enter your name >> Bond
Hi Bond, please enter your company name >> Mart 007
Let's setup a sales menu for 'Mart 007'.
Enter item 1's name >> Spiked Umbrella
Enter item 1's unit price >> 7.25
Enter item 1's quantity >> 5
Enter item 2's name >> Voice Changer
Enter item 2's unit price >> 5.5
Enter item 2's quantity >> 10
Enter item 3's name >> Spy Camera
Enter item 3's unit price >> fifteen
Price must be a number. Please enter again >> -15
Price must be positive. Please enter again >> 15
Enter item 3's quantity >> eight
Stock must be a number. Please enter again >> -8
Stock must be positive. Please enter again >> 8
Great!
Here is the e-list for Mart 007.
------------------ Welcome ------------------
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 5 available
2. Voice Changer ($5.5 each), 10 available
3. Spy Camera ($15.0 each), 8 available
Select product >> 1
You have selected the Spiked Umbrella, how many would you like to buy? >> 2
2 Spiked Umbrella(s) have been selected.
Current total is $14.5.
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 3 available
2. Voice Changer ($5.5 each), 10 available
3. Spy Camera ($15.0 each), 8 available
Press 4 when you are done!
=============================================
Select product >> 2
You have selected the Voice Changer, how many would you like to buy? >> three
Quantity must be a number. Please enter again >> -3
Quantity must be positive. Please enter again >> 3
3 Voice Changer(s) have been selected.
Current total is $31.0.
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 3 available
2. Voice Changer ($5.5 each), 7 available
3. Spy Camera ($15.0 each), 8 available
Press 4 when you are done!
=============================================
Select product >> 1
You have selected the Spiked Umbrella, how many would you like to buy? >> 4
Sorry, only 3 Spiked Umbrella(s) are available in stock.
Please lower the quantity or try a different item.
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 3 available
2. Voice Changer ($5.5 each), 7 available
3. Spy Camera ($15.0 each), 8 available
Press 4 when you are done!
=============================================
Select product >> 1
You have selected the Spiked Umbrella, how many would you like to buy? >> 1
1 Spiked Umbrella(s) have been selected.
Current total is $38.25.
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 2 available
2. Voice Changer ($5.5 each), 7 available
3. Spy Camera ($15.0 each), 8 available
Press 4 when you are done!
=============================================
Select product >> 3
You have selected the Spy Camera, how many would you like to buy? >> 2
2 Spy Camera(s) have been selected.
Current total is $68.25.
=============================================
Please select the item you want
to buy from the following menu:
1. Spiked Umbrella ($7.25 each), 2 available
2. Voice Changer ($5.5 each), 7 available
3. Spy Camera ($15.0 each), 6 available
Press 4 when you are done!
=============================================
Select product >> 4
Thank You!
Here is your invoice!
=============================================
1. Spiked Umbrella x 3 21.75
2. Voice Changer x 3 16.50
3. Spy Camera x 2 30.00
------------------------------------
Subtotal: 68.25
Tax: 8.87
------------------------------------
Total: 77.12
Step by step
Solved in 3 steps with 3 images