Question

In: Computer Science

Python Programming- 9.10 MT Practice Simple Food Receipt 2B """ Enhance your simple food receipt a....

Python Programming- 9.10 MT Practice Simple Food Receipt 2B

"""
Enhance your simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each
question mark]. Do not forget to assign each user
entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each
set of input statements):
Item 1? [add a space after the question mark]
Item 1 price? [add a space after the question mark]
Item 1 number? [add a space after the question mark]
[Note: add space here using print()]
Item 2? [add a space after the question mark]
Item 2 price? [add a space after the question mark]
Item 2 number? [add a space after the question mark]
[Note: add space here using print()]
Item 3? [add a space after the question mark]
Item 3 price? [add a space after the question mark]
Item 3 number? [add a space after the question mark]
[Note: add space here using print()]
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the three items
d. Calculate the total cost plus tax for the order by multiplying the total cose calculated in c by the tax
rate of .0545 (5.45 percent tax) then adding the tax to the total cost
e. Display the results using the structure below. Edit the format string "${:,.2f}".format(identfier) to format the
results of your calculation as currency with the PHP currency type, a space between PHP and the calculated costs,
and 1 decimal place:
RECEIPT
You ordered: [Item 1] [Item 2] [Item 3]
Your cost: [total price for all items calculated in 3c above, formatted with PHP currency and 1 decimal place]
Your cost w tax: {total cost plus tax calculated in 3d above, formatted with PHP currency and 1 decimal place}

"""
#Start your code below

Solutions

Expert Solution

PYTHON CODE:

# getting item 1 name
item1_name = input('Item 1? ')

# getting item 1 price
item1_price = input('Item 1 price? ')

# getting item 1 quantity
item1_quantity = input('Item 1 number? ')
print()

# getting item 2 name
item2_name = input('Item 2? ')

# getting item 2 price
item2_price = input('Item 2 price? ')

# getting item 2 quantity
item2_quantity = input('Item 2 number? ')
print()

# getting item 3 name
item3_name = input('Item 3? ')

# getting item 3 price
item3_price = input('Item 3 price? ')

# getting item 3 quantity
item3_quantity = input('Item 3 number? ')
print()

# converting the string to float, integer
item1_price = float(item1_price)
item1_quantity = int(item1_quantity)
                  
item2_price = float(item2_price)
item2_quantity = int(item2_quantity)

item3_price = float(item3_price)
item3_quantity = int(item3_quantity)

# calculating the total cost

total_cost = item1_price * item1_quantity + (item2_price * item2_quantity) + (item3_price * item3_quantity)

# calculating tax and adding with total cost
total_cost_with_tax = total_cost + total_cost * .0545

# displaying the result
print('You ordered: {0:s} {1:s} {2:s}'.format(item1_name,item2_name,item3_name))
print('Your cost: ${:,.1f}'.format(total_cost))
print('Your cost w tax: ${:,.1f}'.format(total_cost_with_tax))


SCREENSHOT FOR CODING:

SCREENSHOT FOR OUTPUT:


Related Solutions

Python Programming- 9.12 S80 MT Practice 2 """ Enhance your simple food receipt a. Ask the...
Python Programming- 9.12 S80 MT Practice 2 """ Enhance your simple food receipt a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each question mark]. Do not forget to assign each user entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each set of input statements): Name 1? [add a space after the question mark]...
Python Programming- 9.11 S80 MT Practice1 #This is a template for practicing mutability and conversion #Create...
Python Programming- 9.11 S80 MT Practice1 #This is a template for practicing mutability and conversion #Create and assign the following list of numbers to a list data type and variable name: 88.5, 90, 75, 70, 85.6 #convert the list to a tuple and assign the tuple a different variable name #Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name #append the user entered grade to the...
Python Programming Write a simple implementation of a card deck to deal cards out randomly. Your...
Python Programming Write a simple implementation of a card deck to deal cards out randomly. Your Deck class will contain a list of card objects. Initially, the deck will contain one instance of each of the 52 possible cards. Your deck should implement a deal() method that chooses a random location from the list and "pops" that card. You should also implement a cardsLeft method that tells how many cards are left in the deck. Please type code and include...
Please solve using simple python programming language and make it easy to understand explain your code...
Please solve using simple python programming language and make it easy to understand explain your code as I am a beginner, use appropriate variable names which make the code easy to understand and edit if needed. A subsystem responsible for delivering priority numbers to an automated irrigation system has stopped working and you need to deliver a quick fix that will work until the actual subsystem is fixed by senior developer. As you are the newest addition to the development...
2.13 Program: Food receipt (Python 3) 1.Enter food item name: hot dog Enter item price: 2...
2.13 Program: Food receipt (Python 3) 1.Enter food item name: hot dog Enter item price: 2 Enter item quantity: 5 RECEIPT 5 hot dog @ $ 2.0 = $ 10.0 Total cost: $ 10.0 2.Enter food item name: hot dog Enter item price: 2 Enter item quantity: 5 RECEIPT 5 hot dog @ $ 2.0 = $ 10.0 Total cost: $ 10.0 Enter second food item name: ice cream Enter item price: 2.50 Enter item quantity: 4 RECEIPT 5 hot...
Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion...
Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion #Create and assign the following list of numbers to a list data type and variable name: 99.9,88.7,89,90,100 #convert the list to a tuple and assign the tuple a different variable name #Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name #append the user entered grade to the list #update the...
You want to write a simple python program for a food delivery company that asks the...
You want to write a simple python program for a food delivery company that asks the office worker how many drivers they require to deliver their packages to different parts of town. When the user enters the number of drivers, the program will ask how many packages each driver will carry to its destination. It will then calculate the total number of packages and display the result on the screen as below. Sample run: How many drivers do you need?...
Python Programming This assignment will give you practice with interactive programs, if/else statements, collections, loops and...
Python Programming This assignment will give you practice with interactive programs, if/else statements, collections, loops and functions. Problem Description A small car yard dealing in second hand cars needs an application to keep records of cars in stock. Details of each car shall include registration(rego), model, color, price paid for the car (i.e. purchase price) and selling price. Selling price is calculated as purchased price plus mark-up of 30%. For example, Toyota Corolla bought for $20,000 will have the selling...
simple python program : include comments please Let's continue to practice an example using the PriorityQueue...
simple python program : include comments please Let's continue to practice an example using the PriorityQueue from the queue module in Python: Suppose you have been tasked with writing a program that will track the registration waiting list for CCIS 100. Priority is given to seniors, then juniors, etc... Generate a text file (named waitlist.txt) containing the number of credit hours earned, ID number, and email of students who request to be added to the waitlist (1 piece of data...
COSC 1436 Programming Assignment : Skill Practice Assignment 3 Your skill practice assignment this week will...
COSC 1436 Programming Assignment : Skill Practice Assignment 3 Your skill practice assignment this week will be programming challenge #6 on page 374 - Kinetic Energy In it you are asked to write a programing that returns the amount of kinetic energy the object has. You will ask the user to enter values for mass and velocity. You will need to create a function named kinetic Energy that accepts an object's mass (in kilograms) and velocity (in meters per second)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT