วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558

Lab4x : Delivery Charge

def setup():
    print("Parameter1 -> 1=Letter 2=Box")
    print("Parameter2 -> 1=Next Day Priority 2=Next Day Standard 3=2-DAY")
    print("Parameter3 -> Weight (oz for letter / kg for box)")
    print(delivery(1,1,8))

def delivery(pktype,svtype,weight):
    chargebox=0
    text1=""
    # PACKAGE TYPE1
    if (pktype==1):
        if (svtype==1):
            if (weight<=8 and weight>0):
                text1="CHARGE :$ 12.00"
            else:
                text1="Not Avaliable - incorrect weight"
        elif (svtype==2):
            if (weight<=8 and weight>0):
                text1="CHARGE :$ 10.50"
            else:
                text1="Not Avaliable - incorrect weight"
        elif (svtype==3):
          text1="Not Avaliable"
 
    #PACKAGE TYPE2
    if (pktype==2):
        if (svtype==1):
            if (weight>0):
                chargebox=15.75+(weight-1)*1.25
                text1="CHARGE :$ "+chargebox
            else:
                text1="Not Avaliable - incorrect weight"
        elif (svtype==2):
            if (weight>0):
                chargebox=13.75+weight-1
                text1="CHARGE :$ "+chargebox
            else:
                text1="Not Avaliable - incorrect weight"
        elif (svtype==3):
            if (weight>0):
                chargebox=7.00+(weight-1)*0.5;
                text1="CHARGE :$ "+chargebox
            else:
                text1="Not Avaliable - incorrect weight"
    return text1


setup()

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

commit เพิ่มเติม : เพื่ม userstory, bookmark

>>  add userstory ทำการเพิ่ม userstory ใน functional tests >>  add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...