ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology CheckoutRegister Class Diagram CheckoutRegister +remainingPayment_amount:var = 0 +some_money:var = 0 +MAX_BAG_WEIGHT = 5.0 +__init__(self) +can_item(self,product_barcode) +accept_payment(self,some_money) +print_receipt(self) +bag_products(self,product_list) CRICOS Provider No. 00103DPage2of7
ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology Assignment Part 2 – Activity Flowchart CRICOS Provider No. 00103DPage3of7
ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology Assignment Part 3 – Software Implementation Figure1Output CRICOS Provider No. 00103DPage4of7
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology Figure2Output CRICOS Provider No. 00103DPage5of7
ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology Assignment Part 4 – Code Explanation and Use 1.#make a function for accept_payment from customers for their shopping of items defget_float(prompt): 2.#define variable with float value 0.0 value=float(0.0) 3.#run while loop till condition is true for accept payment whileTrue: a.try: i.#input for amount due after accepting payment and give back remained amount to customer value=float(input(prompt)) ii.#check condition for negative values of amount using if loop ifvalue<0.0: print("We don't accept negative money!") continue iii.#if this condition matches then jump from this loop to next step break b.#exception handling for value error exceptValueError: print('Please enter a valid floating point value.') 4.#pass the total amount where this function called for shopped product by customers returnvalue #make a function for bag_products to append the items from the shopped item list to bag_list until weight of bag is less than and equal to the MAX_BAG_WEIGHT # extra items move to non_bagged_list 5.defbag_products(product_list): 6.#make a list of bag_list, non_bagged_items and set max weight to 0.5 bag_list=[] non_bagged_items=[] MAX_BAG_WEIGHT=5.0 6.#run for loop for products in product list forproductinproduct_list: 7.#check for condition using if-else for pro_weight > MAX_BAG_WEIGHT and do removing or appending of items from product_list and non_bagged_items ifproduct.weight>MAX_BAG_WEIGHT: product_list.remove(product) non_bagged_items.append(product) 8.#make a list for current_bag_contents and 0.0 value for current_bag_weight current_bag_contents=[] CRICOS Provider No. 00103DPage6of7
ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology current_bag_weight=0.0 9.#run while loop for given condition whilelen(product_list)>0: 10.#swapping of values and remove temporary product after swap from product_list temp_product=product_list[0] product_list.remove(temp_product) 11.#check for given condition using if-else conditions ifcurrent_bag_weight+temp_product.weight<MAX_BAG_WEIGHT: 12.#add temporary_product into current_bag_contents current_bag_contents.append(temp_product) current_bag_weight+=temp_product.weight 13.#check length of product list using if condition which is equal to 0 add append to current_bag_contents if(len(product_list)==0): bag_list.append(current_bag_contents) 14.# otherwise if product list is not empty then append to current bag contents else: bag_list.append(current_bag_contents) 15.#enumerate(bag_list ) adds a counter to an iterate forindex,baginenumerate(bag_list): output='Bag '+str(index+1)+' contains: ' 16.#show products which are in bag forproductinbag: output+=product.name+'\t' print(output,'\n') 17.#check condition using if loop for non_bagged_items length should not be greater than 0 if(len(non_bagged_items)>0): output='Non-bagged items: ' 18.#for loop to print non_bagged_items foriteminnon_bagged_items: output+=item+'\t' print(output,'\n') CRICOS Provider No. 00103DPage7of7