Saturday, September 19, 2015

Lab 4x Hello Python - Delivery charge, see question 20 on page 299

def setup():
  cal_charge(0, 1, 8);


def cal_charge(packaging, services, weight):

    print("Type of package (Letter=0/Box=1) is " ,packaging)
    print("Type of service (Next Day Priority=0/Next Day Standard=1/Two-Day=2) is " ,services)
    print("Weight is " ,weight ," oz")
    print();
 
    if(packaging == 0 and services == 0 and weight <= 8):
    
       print("The total is $12.00")
    
    elif(packaging == 0 and services == 1 and weight <= 8):
    
       print("The total is $10.50")
    
    elif(packaging == 0 and services == 2):
    
       print("Not avaliable")
   
    elif(packaging == 1 and services == 0):
        if (weight <= 16):
      
            print("The total is $15.75")
      
        else:
          
         weight = weight/16;
         add = 15.75,((ceil(weight)-1)*1.25);
         print("The total is $" ,add)
      
    
    elif(packaging == 1 and services == 1):
      
        if (weight <= 16):
      
         print("The total is $13.75")
      
        else:
      
         weight = weight/16
         add = 13.75,((ceil(weight)-1)*1.00)
         print("The total is $" ,add)
      
  
    elif(packaging == 1 and services == 2):
      
        if (weight <= 16):
      
         print("The total is $7.00")
      
        else:
      
         weight = weight/16
         add = 7.00,((ceil(weight)-1)*0.50)
         print("The total is $" ,add)

setup()

No comments:

Post a Comment