Advertisement
182days

(0478) 2016 Pre Task 3

Apr 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.07 KB | None | 0 0
  1. #pre-release
  2. #paper 2 2016
  3.  
  4. #counter setting
  5. total_price = 0
  6. total_price_all = 0
  7. a_parcel_count = 0
  8. r_parcel_count = 0
  9. total_weight = 0
  10. while True: #start loop
  11.     x = int(input("Enter the width of the parcel...")) #collect inputs
  12.     y = int(input("Enter the length of the parcel..."))
  13.     z = int(input("Enter the depth of the parcel..."))
  14.     w = int(input("Enter the weight of the parcel..."))
  15.     d = x + y + z
  16.     if x <=80 and y <=80 and z <=80 and d <=200 and w >=1 and w <=10: #apply logic to inputs
  17.         print("Parcel Accepted!")
  18.         a_parcel_count = a_parcel_count + 1 #update parcel count
  19.         total_weight = total_weight + (w) #update weights
  20.         if w < 5: #calculate price of parcel under 5kg
  21.             total_price = 10
  22.             total_price_all = total_price_all + total_price #update prices
  23.         else: #calculate price of parcel over 5kg
  24.             w1 = w-5 #remove first 5kg
  25.             w2 = w1 / 0.1
  26.             w3 = w2 * 0.1
  27.             w4 = w3 + 10 #calculate cost of remainder and add original 5kg
  28.             total_price = w4
  29.             total_price_all = total_price_all + total_price #update prices
  30.     else:
  31.         r_parcel_count = r_parcel_count + 1 #update parcel count
  32.         print("Parcel rejected due to...") #return reasons for rejection
  33.         if x >80:
  34.             print("Width too big")
  35.         if y >80:
  36.             print("Length too big")
  37.         if z >80:
  38.             print("Depth too big")
  39.         if d >200:
  40.             print("Dimensions too big")
  41.         if w <1:
  42.             print("Weight too light")
  43.         if w >10:
  44.             print("Weight too heavy")
  45.     print("\n")
  46.     print("------Consignment Summary---------") #print summary of values and counters
  47.     print("Total number of accepted parcels is", (a_parcel_count))
  48.     print("Total number of rejected parcels is", (r_parcel_count))
  49.     print("Total consignment weight is", (total_weight), "kg")
  50.     print("------Consignment Price-----------")
  51.     print("Parcel price is", (total_price))
  52.     print("Total consignment price is", (total_price_all))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement