Write a python program called a2_q1.py that asks the user (business owner) for their product information and creates an electronic list (e-list) of items. In part-2 of this assignment, customers should be able to use this e-list to purchase multiple products of varying quantities while products are available in stock. Your program should start by asking the business owner’s name (string) and the name of the company (string). Next, it should ask for three (3) product names (strings), their unit prices (floats), and the

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

1. Write a python program called a2_q1.py that asks the user (business owner) for their product information and creates an electronic list (e-list) of items. In part-2 of this assignment, customers should be able to use this e-list to purchase multiple products of varying quantities while products are available in stock.
Your program should start by asking the business owner’s name (string) and the name of the company (string). Next, it should ask for three (3) product names (strings), their unit prices (floats), and the total number of products in stock (ints). Finally, it should display the list of items.

Note: users are always allowed to enter any type of data when asked for input. Your program must always verify the user input. Invalid input should be handled with suitable error messages for each type of invalid input and the prompt should be repeated. To keep things simple, we will consider that when prompted a user can enter either an integer, a string, or a float (i.e., not a combination of letters and digits).
Hint: you may want to use while loops to validate user inputs, i.e., repeat the loop until the user enters the correct (type of) input.

QUESTION 1: Sample output (user input is highlighted for emphasize):
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
Press 4 when you are done!
Transcribed Image Text:QUESTION 1: Sample output (user input is highlighted for emphasize): 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 Press 4 when you are done!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education