Thursday, February 11, 2021

Assignment#4 due 2/17/21, 2/11/2021, 2:37 PM, English, 2/11/2021, 2:37 PM

Your assigned language is: English
Classroom blog: googleclouduconn.blogspot.com

2/11/2021, 2:37 PM

Assignment #4
Build a Python Invoicer program that lists 4 items that you want to
sell and produce a total.
Note you can not duplicate my items.

https://googleclouduconn.blogspot.com/p/python-invoicer.html

#!/usr/bin/python3
# DATA TYPE Examples
########## DICTIONARY #################

cust_name = input("Customer name: ")
cust_address = input(" Address: ")
cust_city = input(" City: ")
cust_state = input(" State: ")
cust_zip = input(" Zip: ")
print(cust_name)
print(cust_address)
items = {"plates" : 3, "cups" : 1, "glasses" : 2}
for x in items:
print(x, items[x])
no_plates = input("Number of Plates: ")
no_cups = input("Number of Cups: ")
no_glasses = input("Number of Glasses: ")
total_plates = int(no_plates) * int(items["plates"])
total_cups = int(no_cups) * int(items["cups"])
total_glasses = int(no_glasses) * int(items["glasses"])
total_charge = int(total_plates) + int(total_cups) + int(total_glasses)
print(cust_name)
print(cust_address)
print(cust_city)
print(cust_zip)
print(total_charge)
myplates = "You Bought {} number of plates at {} = {} dollars."
print(myplates.format(no_plates, items["plates"], total_plates))
mycups = " {} number of cups at {} = {} dollars."
print(mycups.format(no_cups, items["cups"], total_cups))
myglasses = " {} number of glasses at {} = {} dollars."
print(myglasses.format(no_glasses, items["glasses"], total_glasses))
mytotal = " Total Amount Due = {} dollars."
print(mytotal.format(total_charge))

john_iacovacci1@cloudshell:~/pyprojects/assign4 (uconn-engr)$ python3
invoicer.py
Customer name: John
Address: 55 daff
City: Stamford
State: CT
Zip: 06903
John
55 daff
plates 3
cups 1
glasses 2
Number of Plates: 5
Number of Cups: 5
Number of Glasses: 5
John
55 daff
Stamford
06903
30
You Bought 5 number of plates at 3 = 15 dollars.
5 number of cups at 1 = 5 dollars.
5 number of glasses at 2 = 10 dollars.
Total Amount Due = 30 dollars.
john_iacovacci1@cloudshell:~/pyprojects/assign4 (uconn-engr)$

No comments:

Post a Comment

Office hours tomorrow(Tuesday) 5:00pm-6:00pm, 4/26/2021, 5:13 PM, English, 4/26/2021, 5:13 PM

Your assigned language is: English Classroom blog: googleclouduconn.blogspot.com 4/26/2021, 5:13 PM Office hours tomorrow(Tuesday) 5...