0% found this document useful (0 votes)
13 views

Laboratory #2: A. Total Purchase

The document contains two Python code snippets that calculate totals for different purchase scenarios. The first calculates subtotal, tax, and total for multiple items purchased. The second calculates tip, tax, and total for a restaurant meal.

Uploaded by

Sydney Plata
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Laboratory #2: A. Total Purchase

The document contains two Python code snippets that calculate totals for different purchase scenarios. The first calculates subtotal, tax, and total for multiple items purchased. The second calculates tip, tax, and total for a restaurant meal.

Uploaded by

Sydney Plata
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PLATA, Alyssa Sydney L.

FE-1201

LABORATORY #2
A. Total Purchase

print("Please enter the price of each item" "\n")

item1 = float(input( "First item:" "\nPhp"))


item2 = float(input( "Second item:" "\nPhp"))
item3 = float(input( "Third item:" "\nPhp"))
item4 = float(input( "Fourth item:" "\nPhp"))
item5 = float(input( "Fifth item:" "\nPhp"))

print("\n")

subTotal = item1 + item2 + item3 + item4 + item5


tax = 0.06 * subTotal
Total = tax + subTotal

print("Sub Total: Php" + format(subTotal, ",.2f") )


print("Tax amount : Php" + format(tax, ",.2f") )
print("Total amount: Php" + format(subTotal, ",.2f") )

print("\n")
print("Thank you for purchasing!" )

result:
PLATA, Alyssa Sydney L.
FE-1201

B. Tip, Tax, and Total

mealCharge = float( input("Enter the charge of the meal: Php"))

tip = 0.18 * mealCharge


tax = 0.1 * mealCharge
total = mealCharge + tip + tax

print("\n")

print("Meal Charge: Php" + format(mealCharge, ",.2f"))


print("Tip: Php" + format(tip, ",.2f"))
print("Tax: Php" + format(tax, ",.2f"))
print("Total amount: Php" + format(total, ",.2f") )

print("\n")

print("Thank you for dining with us!")

result:

You might also like