use python code only Create a program that determines the c

###use python code only ### Create a program that determines the cost of sending out coffee. The Konditorei coffee shop sells coffee at $10.50 a pound for their Jonestown Brew, and $16.95 for their Plymouth Jolt. The cost of shipping is $0.93 per pound. In addition, there is a handling cost of $2.50 per order. When the user places an order they will choose one of the two types of coffee, they will enter the number of pounds they are ordering. They will enter in their City and State. They will pick the shipping method: Overnight, 2-Day or Standard. They will enter in their payment option: PayPal, Credit Card, Check. You will display the Coffee type and number of pounds they have ordered, the Sub-Total, the Shipping & Handling Costs, the City and State it is being shipped to, the Delivery Method, the Payment type, The Tax and the Total. Format in US currency where appropriate. Tax is 9% for Washington, California and Texas, 0% for Oregon or Florida, all other are 7%. Tax is applied to the Sub-Total. The delivery methods are Overnight ($20.00), 2-Day ($13.00), Standard ($0.00). For Payment options, Paypal has a 3% fee (of the Sub-Total), Credit Cards has a 5% fee (of the Sub-Total), and Checks have a 2% discount (of the Sub-Total), You are required to use functions. One function to determine the Shipping & Handling costs, another function to determine the Tax and another to determine the Sub-Total. Use a Try Except block to catch the program from blowing up. ###use python code only ### Thank you.......

Solution

def shipping_cost(shipping_choice, handling):
    if shipping_choice == 1:
        return 20+handling
    elif shipping_choice == 2:
        return 13+handling
    else:
        return 0+handling

def tax(state):
    if state.lower()== \"washington\" or state.lower()== \"california\" or state.lower()== \"texas\":
        tax = 0.09
    elif state.lower()==\"oregon\" or state.lower()==\"florida\":
        tax = 0
    else:
        tax = 0.07
    return tax

def subtotal(jb, pj, coffee_choice, quantity, tax, shipping, payment_choice):
    if coffee_choice==1:
        cost = jb*quantity
    else:
        cost = pj*quantity
    cost += shipping
    cost += tax*cost

    if payment_choice==1:
        cost += 0.03*cost
    elif payment_choice ==2:
        cost += 0.05*cost
    else:
        cost -= 0.02*cost
    return cost

jb = 10.5 #price of jonestown brew
pj = 16.95 #price of plymouth jolt
shipping = 0.93
handling = 2.5

coffee_choice = input(\"Enter 1 for jonestown brew and 2 for plymouth jolt: \")
while coffee_choice != 1 and coffee_choice!= 2:
    print \"Please enter a valid option.\ \ \"
    coffee_choice = input(\"Enter 1 for jonestown brew and 2 for plymouth jolt: \")

quantity = input(\"Enter the amount of coffee you want to order in pounds: \")
if type(quantity) != float and type(quantity) != int:
    print \"Please enter a valid option.\ \ \"
    quantity = input(\"Enter the amount of coffee you want to order in pounds: \")

state = raw_input(\"Please enter your state: \")

shipping_choice = input(\"Enter 1 for overnight, 2 for 2-day and 3 for standard: \")
while shipping_choice !=1 and shipping_choice !=2 and shipping_choice !=3:
    print \"Please enter a valid option.\ \ \"
    shipping_choice = input(\"Enter 1 for overnight, 2 for 2-day and 3 for standard: \")

payment_choice = input(\"Enter 1 for payment through paypal, 2 for credit cards and 3 for check: \")
while payment_choice !=1 and payment_choice !=2 and payment_choice !=3:
    print \"Please enter a valid option.\ \ \"
    payment_choice = input(\"Enter 1 for payment through paypal, 2 for credit cards and 3 for check: \")

print subtotal(jb, pj, coffee_choice, quantity, tax(state), shipping_cost(shipping, handling), payment_choice)

###use python code only ### Create a program that determines the cost of sending out coffee. The Konditorei coffee shop sells coffee at $10.50 a pound for their
###use python code only ### Create a program that determines the cost of sending out coffee. The Konditorei coffee shop sells coffee at $10.50 a pound for their

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site