Question: The user should make their selection by entering the corresponding number. It is possible the user will enter any type of data, including text, floating
The user should make their selection by entering the corresponding number. It is possible the user will enter any type of data, including text, floating point numbers, negative numbers, etc.. Invalid selections should be handled with a suitable error message and the menu should be repeated. Once the customer has selected a product, the program should ask how many of that product the customer would like. Following this, the program will ask whether the user wants to continue and see the invoice or cancel the transaction. If user wants to continue it should provide the user with their receipt (subtotal, tax (13% of the subtotal) and total cost of the order). Otherwise it should print a message and terminates.
Sample output:
it first prints similar content as shown before and then
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 5
Sorry, 5 is not a valid choice! Please select from the menu.
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 2
How many Hat do you want? 2
Current total: $4.00
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 1
How many Cake do you want? 5
Current total: $11.50
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 3
How many Magic wand do you want?
1 Current total: $13.49
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 1 How many Cake do you want?
1 Current total: $14.99
===========================================================
Please select what you want to buy from the following menu:
1. Cake (each $1.50)
2. Hat (each $2.00)
3. Magic wand (each $1.99)
4. Done!
===========================================================
> 4
Do you want to continue and see the invoice (i) or cancel the transaction (c)?
> i
Your invoice is here!
=====================
Subtotal: $14.99
Tax: $1.95
---------------------
Total: $16.94
=====================
Sample output (if c is selected):
Do you want to continue and see the invoice (i) or cancel the transaction (c)?
> c
Thank you for trying!
use python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
