Problem 1 For this assignment you will develop an automated invoice generator that helps a shop owner to design their invoice. Throughout the three parts of this assignment you will build a successively more complex solution to this problem. Please be sure to read through the entire assignment before you begin to code it. Requirement 1.1 (Defining products and Creating a Menu) Write a program called HW2_Q1.py that asks a shop owner for product information and creates a menu system that allows customers to purchase multiple products of varying quantities. The program should start by asking the shop owner’s name and company name. Next it should ask for three (3) products and their prices. Finally, it should display a menu. Use 2 functions for this question. Namely: shop_details() – returns all required info for menu() function menu(product_1, price_1,product_2, price_2,product_3, price_3) - displays the menu Below is a sample run of the program that demonstrates how your output could look (user input is highlighted for emphasis):   Sample output: What is your name: Ashraf Elnagar What is your company name? STAR Hi Ashraf Elnagar! We can set up your 'STAR' sales menu. Please enter 3 products and the prices you would like to sell. Enter Product 1 and its price: > Cake > 1.5 Enter Product 2 and its price: > Hat > 2 Enter Product 3 and its price: > Magic wand > 1.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! ========================================================== Requirement 1.2 (Using the menu and printing an invoice) Add code to the program file HW2_1.py so that customers can select products from the menu. Retain a copy of your previous solution. Do not overwrite your previous solution. 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. Add more functions for this question. Namely: valid_input(…) – to validate user entry for choices [1-4] show_invoice(…) – to display the invoice process_total(…)– to compute total and call show_invoice(), if needed   Sample Output: … it first prints similar content as shown before and then …… =========================================================== Please select what you want to buy from the following menu: 4. Cake (each $1.50) 5. Hat (each $2.00) 6. Magic wand (each $1.99) 7. 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: Page 4 of 7 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!

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter8: Working With Advanced Functions
Section: Chapter Questions
Problem 2.8CP
icon
Related questions
Question
100%

Problem 1
For this assignment you will develop an automated invoice generator that helps a shop owner to design their invoice. Throughout the three parts of this assignment you will build a successively more complex solution to this problem. Please be sure to read through the entire assignment
before you begin to code it.

Requirement 1.1 (Defining products and Creating a Menu)

Write a program called HW2_Q1.py that asks a shop owner for product information and creates a menu system that allows customers to purchase multiple products of varying quantities. The program should start by asking the shop owner’s name and company name. Next it should ask for
three (3) products and their prices. Finally, it should display a menu. Use 2 functions for this question. Namely:


shop_details() – returns all required info for menu() function
menu(product_1, price_1,product_2, price_2,product_3, price_3) - displays the menu


Below is a sample run of the program that demonstrates how your output could look (user input is highlighted for emphasis):

 

Sample output:
What is your name: Ashraf Elnagar
What is your company name? STAR
Hi Ashraf Elnagar! We can set up your 'STAR' sales menu.
Please enter 3 products and the prices you would like to sell.
Enter Product 1 and its price:
> Cake
> 1.5
Enter Product 2 and its price:
> Hat
> 2
Enter Product 3 and its price:
> Magic wand
> 1.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!
==========================================================

Requirement 1.2 (Using the menu and printing an invoice)

Add code to the program file HW2_1.py so that customers can select products from the menu. Retain a copy of your previous solution. Do not overwrite your previous solution.


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. Add more functions for this question. Namely:


valid_input(…) – to validate user entry for choices [1-4]
show_invoice(…) – to display the invoice
process_total(…)– to compute total and call show_invoice(), if needed

 

Sample Output:


… it first prints similar content as shown before and then ……
===========================================================
Please select what you want to buy from the following menu:
4. Cake (each $1.50)
5. Hat (each $2.00)
6. Magic wand (each $1.99)
7. 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:
Page 4 of 7
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!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage