Advertisement
Guest User

clara main file2

a guest
Nov 21st, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. def main():
  2.    dTotalPrice = 0.0        
  3.    iTotalWeight = 0
  4.    # Put the 4 items being ordered in item1 through item 4        
  5.    item1 = Item.Item(24.99, 14, "Wireless Mouse")        
  6.    item2 = Item.Item(22.49, 27, "USB Keyboard")        
  7.    item3 = Item.Item(24.99, 12, "HDMI Cable")        
  8.    item4 = Item.Item(7.99, 7, "Reading Glasses")        
  9.    item4.set_quantity(2);  
  10. ​​
  11.    # Show the details of the order using show()        
  12.    print("Here are your shopping cart contents.")        
  13.    print(item1);        
  14.    print(item2);        
  15.    print(item3);        
  16.    print(item4);
  17. ​​
  18.    # Compute the total price and total weight in this section        
  19.    dTotalPrice += item1.getOrderPrice()        
  20.    dTotalPrice += item2.getOrderPrice()        
  21.    dTotalPrice += item3.getOrderPrice()        
  22.    dTotalPrice += item4.getOrderPrice()        
  23.    iTotalWeight += item1.getOrderWeightInOunces()        
  24.    iTotalWeight += item2.getOrderWeightInOunces()        
  25.    iTotalWeight += item3.getOrderWeightInOunces()        
  26.    iTotalWeight += item4.getOrderWeightInOunces()        
  27.    # Here we show the order details        
  28.    print("The price of your order is $" + str(dTotalPrice));        
  29.    print("The shipping weight is", (int)(iTotalWeight / 16),
  30.          "pounds", iTotalWeight % 16 , "ounces");    
  31.  
  32.    
  33. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement