Question: Write a program that prompts the user for the name of an item that they intend to buy, the cost of the item, and the
Write a program that prompts the user for the name of an item that they intend to buy, the cost of the item, and the quantity they wish to purchase. Based on this information, display the total cost of the purchase.
Notes:
Quantities may only be expressed as whole numbers
Orders of more than items and orders totaling more than $ qualify for a discount
You are not responsible for checking for invalid quantities or prices ex: negative values
Display a single item using the name entered. Display multiples of an item by adding an s to the name entered, even if it is grammatically incorrect.
Enter item name: Microwave Ramen Cooker
Enter price for one Microwave Ramen Cooker:
Enter quantity desired:
An order of Microwave Ramen Cookers will cost a total of $
Enter item name: Vegan Messenger Bag
Enter price for one Vegan Messenger Bag:
Enter quantity desired:
An order of Vegan Messenger Bag will cost a total of $
Note: Price reflects a discount.
We ask that you do the input and output in the "main" area and that you define a function called calculateTotalPrice which receives the price of the item and the quantity desired and returns a number representing the total price, including any applicable discount.
Remember that you can use multiple print statements to print to the same line by adding end to the print statement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
