+1 (315) 557-6473 

Designing a Smoothie Ordering and Book Shipping applications in Python assignment help

This assignment consists of designing three Python code files to represent a Smoothie ordering system, an application to prepare shipping books, and a series of functions to represent and obtain information (rank and suit) from a deck of 52 Poker cards. All three applications are designed as explained below by our Python assignment helpers. The Smoothie ordering application should show a menu to the user, where they can choose the type of Smoothie, the size, and the toppings. Once this is done, the final cost of the selected Smoothie will be displayed. The application for sending books must perform calculations on the number of books that can be ordered in a box, confirm the ISBN, verify that the ISBN is valid. The application should show a menu to the user where they can choose one of the aforementioned options. The application to represent the deck of 52 cards must contain functions that allow obtaining the rank or suit of a card given its number, and vice versa, check if two cards a

Book Ordering and Shipping Program

Smoothie.py """ Smoothie Ordering """ SMOOTHIE1_NAME ="Pineapple Banana" SMOOTHIE1_COST =4.99 SMOOTHIE2_NAME ="Almond Basil" SMOOTHIE2_COST =6.49 SMOOTHIE3_NAME ="Purple Surprise" SMOOTHIE3_COST =0.99 SMOOTHIE4_NAME ="Onion Toffee" SMOOTHIE4_COST =9.99 SIZE1_NAME ="small" SIZE1_COST =-2.0 SIZE2_NAME ="medium" SIZE2_COST =0.0 SIZE3_NAME ="large" SIZE3_COST =2.0 SIZE4_NAME ="galactic" SIZE4_COST =100.0 TOPPING1_NAME ="no topping" TOPPING1_COST =0.0 TOPPING2_NAME ="cinnamon" TOPPING2_COST =1.0 TOPPING3_NAME ="chocolate shavings" TOPPING3_COST =1.0 TOPPING4_NAME ="shredded coconut" TOPPING4_COST =1.0 types_name= [SMOOTHIE1_NAME, SMOOTHIE2_NAME, SMOOTHIE3_NAME, SMOOTHIE4_NAME] types_cost= [SMOOTHIE1_COST, SMOOTHIE2_COST, SMOOTHIE3_COST, SMOOTHIE4_COST] sizes_name= [SIZE1_NAME, SIZE2_NAME, SIZE3_NAME, SIZE4_NAME] sizes_cost= [SIZE1_COST, SIZE2_COST, SIZE3_COST, SIZE4_COST] topping_name= [TOPPING1_NAME, TOPPING2_NAME, TOPPING3_NAME, TOPPING4_NAME] topping_cost= [TOPPING1_COST, TOPPING2_COST, TOPPING3_COST, TOPPING4_COST] defpose_question_with_costs(question, option1, cost1, option2, cost2, option3, cost3, option4, cost4): # Print question print(question) # Print options print("1)\t$ {0:.2f}\t{1}".format(cost1, option1)) print("2)\t$ {0:.2f}\t{1}".format(cost2, option2)) print("3)\t$ {0:.2f}\t{1}".format(cost3, option3)) print("4)\t$ {0:.2f}\t{1}".format(cost4, option4)) option =input("Your choice(1-4): ") ifoption.isnumeric() andint(option) >=1andint(option) <=4: option =int(option) option_name="" if option ==1: option_name= option1 elif option ==2: option_name= option2 elif option ==3: option_name= option3 elif option ==4: option_name= option4 print("You have selected "+option_name+".") returnoption_name return"" defcalculate_subtotal(smoothie_type, smoothie_size, topping): idx1 =types_name.index(smoothie_type) idx2 =sizes_name.index(smoothie_size) idx3 =topping_name.index(topping) subtotal =types_cost[idx1] +sizes_cost[idx2] +topping_cost[idx3] returnround(subtotal, 2) defprint_receipt(subtotal, smoothie_type, smoothie_size, topping): text ="You ordered a "+smoothie_size+" "+smoothie_type+" smoothie" iflen(topping) >0: text = text +" with "+ topping text = text +"." print(text) QST =9.975/100.0*subtotal GST =5.0/100.0*subtotal total = subtotal + QST + GST print("Smoothie cost: $ {0:.2f}".format(subtotal)) print("GST:\t$ {0:.2f}".format(GST)) print("QST:\t$ {0:.2f}".format(QST)) print("Total:\t$ {0:.2f}".format(total)) return total deforder(): print("Welcome to Smooth Smoothies Smoothie Ordering System") print("Have you tried our new Onion Toffee Smoothie?") smoothie =pose_question_with_costs("Which smoothie would you like?", SMOOTHIE1_NAME, SMOOTHIE1_COST, SMOOTHIE2_NAME, SMOOTHIE2_COST, SMOOTHIE3_NAME, SMOOTHIE3_COST, SMOOTHIE4_NAME, SMOOTHIE4_COST) iflen(smoothie) ==0: # empty string print("Sorry, that is not a valid option.") return else: # Check if user selected the new Smoothie ifsmoothie !="Onion Toffee": print("Unfortunely, we are out of "+ smoothie) smoothie ="Onion Toffee" print("You will be served "+ smoothie +" smoothie.") size =pose_question_with_costs("Which size would you like?", SIZE1_NAME, SIZE1_COST, SIZE2_NAME, SIZE2_COST, SIZE3_NAME, SIZE3_COST, SIZE4_NAME, SIZE4_COST) iflen(size) ==0: print("Sorry, that is not a valid option.") return else: topping =pose_question_with_costs("Which topping would you like?", TOPPING1_NAME, TOPPING1_COST, TOPPING2_NAME, TOPPING2_COST, TOPPING3_NAME, TOPPING3_COST, TOPPING4_NAME, TOPPING4_COST) iflen(topping) ==0: print("Sorry, that is not a valid option.") return else: subtotal =calculate_subtotal(smoothie, size, topping) total =print_receipt(subtotal, smoothie, size, topping) Shipment.py importmath # Shipping Books SMALL_DIMENSIONS = [10, 10, 2] MEDIUM_DIMENSIONS = [15, 15, 3] LARGE_DIMENSIONS = [20, 20, 4] defcalculate_isbn_checksum_by_digits(d1, d2, d3, d4, d5, d6, d7, d8, d9): checksum = (d1 +2*d2 +3*d3 +4*d4 +5*d5 +6*d6 +7*d7 +8*d8 +9*d9)%11 returnstr(checksum) defcalculate_isbn_checksum(isbn): # Convert to str isbn_str=str(isbn) n =1 checksum =0 for dinisbn_str: checksum = checksum + n*int(d) n +=1 checksum = checksum %11 returnstr(checksum) defis_isbn(isbn, checksum): returncalculate_isbn_checksum(isbn) == checksum defbooks_fits_in_box(box_w, box_d, box_h, book_w, book_d, book_h): returnbook_w<=box_wandbook_d<=box_dandbook_h<=box_h defget_smalles_box_for_book(book_w, book_d, book_h): # Check with dimensions of boxes, from smalles to larger ifbook_w<= SMALL_DIMENSIONS[0] andbook_d<= SMALL_DIMENSIONS[1] andbook_h<= SMALL_DIMENSIONS[2]: return"small" elifbook_w<= MEDIUM_DIMENSIONS[0] andbook_d<= MEDIUM_DIMENSIONS[1] andbook_h<= MEDIUM_DIMENSIONS[2]: return"medium" elifbook_w<= LARGE_DIMENSIONS[0] andbook_d<= LARGE_DIMENSIONS[1] andbook_h<= LARGE_DIMENSIONS[2]: return"large" return'' defget_num_books_for_box(box_w, box_d, box_h, book_w, book_d, book_h): # Check how many books fits by width n_width=box_w/book_w n_depth=box_d/book_d n_height=box_h/book_h # Now, select the smalles of these three numbers, rounded to lowest n_final=min(n_width, n_depth) n_final=min(n_final, n_height) returnmath.floor(n_final) defmain(): # Show greet message print("Welcome to the shipment calculation system.") print("1) Check ISBN") print("2) Check box/book size") print("3) Get smallest box size for book") print("4) Get num equally-sized books per box") choice =input("Enter choice (1-4): ") ifchoice.isnumeric() andint(choice) >=1andint(choice) <=4: choice =int(choice) if choice ==1: #Check ISBN ISBN =int(input("Enter ISBN: ")) checksum =input("Enter checksum: ") result =is_isbn(ISBN, checksum) if result ==True: print("ISBN is valid (checksum did match).") else: print("ISBN is not valid (checksum did not match).") elif choice ==2: box_w=int(input("Enter box width: ")) box_d=int(input("Enter box depth: ")) box_h=int(input("Enter box height: ")) book_w=int(input("Enter book width: ")) book_d=int(input("Enter book depth: ")) book_h=int(input("Enter book height: ")) result =books_fits_in_box(box_w, box_d, box_h, book_w, book_d, book_h) if result ==True: print("Package does fits in box.") else: print("Package does not fits in box.") elif choice ==3: # Get smallest box size book_w=int(input("Enter book width: ")) book_d=int(input("Enter book depth: ")) book_h=int(input("Enter book height: ")) result =get_smalles_box_for_book(book_w, book_d, book_h) ifresult !="": print("The smaller box for book is "+ result +".") else: print("Package does not fits in any box.") elif choice ==4: box_w=int(input("Enter box width: ")) box_d=int(input("Enter box depth: ")) box_h=int(input("Enter box height: ")) book_w=int(input("Enter book width: ")) book_d=int(input("Enter book depth: ")) book_h=int(input("Enter book height: ")) result =get_num_books_for_box(box_w, box_d, box_h, book_w, book_d, book_h) print("The number of books that fits in the box is "+str(result) +".") Card.py # Cards # Hearts, Diamonds, Clubs, and Spades HEARTS =0 DIAMONDS =1 CLUBS =2 SPADES =3 TWO =0 THREE =1 FOUR =2 FIVE =3 SIX =4 SEVEN =5 EIGHT =6 NINE =7 TEN =8 JACK =9 QUEEN =10 KING =11 ACE =12 defget_suit(card): SUITS = [HEARTS, DIAMONDS, CLUBS, SPADES] k =1 card_copy = card while card_copy >0: card_copy -=4 k +=1 k-=1 return SUITS[card-k*4-1] defget_rank(card): k =0 v =0 for i inrange(1,card+1): v +=1 if v >4: v =1 k +=1 return k defsame_rank(card1, card2): return get_rank(card1) == get_rank(card2) defsame_suit(card1, card2): return get_suit(card1) == get_suit(card2) defsame_color_suit(card1, card2): # Check if both are hearts or both are diamonds, if one is diamond and the other hearth and vice versa # Check if both are clubs or both are spades, if one is a club and the other spade and vice versa # Check if both are hearths cond1 = get_suit(card1) == HEARTS and get_suit(card2) == HEARTS # Check if one is heart and the other is diamond cond2 = (get_suit(card1) == HEARTS and get_suit(card2) == DIAMONDS) or (get_suit(card1) == DIAMONDS and get_suit(card2) == HEARTS) # Check if both are diamonds cond3 = get_suit(card1) == DIAMONDS and get_suit(card2) == DIAMONDS # Check if both are clubs cond4 = get_suit(card1) == CLUBS and get_suit(card2) == CLUBS # Check if one is club and the other is spades cond5 = (get_suit(card1) == CLUBS and get_suit(card2) == SPADES) or (get_suit(card2) == CLUBS and get_suit(card1) == SPADES) # Check of both are spades cond6 = get_suit(card1) == SPADES and get_suit(card2) == SPADES return cond1 or cond2 or cond3 or cond4 or cond5 or cond6