Question: Create a program using floored division and the modulo operator Description Suppose you are working for an online bookseller, who specializes in coffee table books

 Create a program using floored division and the modulo operator DescriptionSuppose you are working for an online bookseller, who specializes in coffee

Create a program using floored division and the modulo operator Description Suppose you are working for an online bookseller, who specializes in coffee table books with colorful pictures. You have customers who routinely order multiple books at a time. You need to figure out, given a customer's order, how many standard full boxes will need to be shipped, and how many books are left over to be shipped in a smaller box. Objectives The objectives of this lab are as follows: to become familiar with floored division and the modulo operator to practice arithmetic expressions and assignment to variables to think about types and use type conversion to review input and output operators A standard shipping box is 18 inches long x 12 inches wide x 10.5 inches tall. A standard size hardcover coffee table book is 16 inches long x 10 inches wide x 1.2 inches thick. Books are stacked into the shipping boxes one on top of the other, with one inch padding on each side. In other words, one book plus side padding will exactly fit into the bottom of the box. Your program will ask the user for the number of books the customer is ordering, and then compute how many standard boxes will need to be shipped. Use one variable to keep track of the number of boxes. Think about how you would solve this problem without a computer, and write down the steps you need (the algorithm). Then translate that algorithm into a Python program. Much of the program is already given to you. You should use floor division and the modulo operator to solve this problem. Ex: If the input is 15, the output is: Ex: If the input is 15, the output is: We will need 1 standard boxes. There will be 7 books left to ship in a smaller box. Ex: If the input is 25, the output is: We will need 3 standard boxes. There will be 1 books left to ship in a smaller box. 301826.1771416 LAB ACTIVITY 3.12.1: Lab 3B: Pack a box (floor division) 0/25 main.py 1 # compute number of boxes for given number of books 2 3 box_height = 10.5 4 book_thickness = 1.2 5 6 # compute the number of books per standar box. 7 books_per_box = 10.5 // 1.2 8 9 # now ask the user for the number of books the customer ordered 10 books_ordered = int(input("Input the number of books in the order: ")) 11 12 # compute the number of boxes needed. Store it in the variable called "num_boxes" 13 num_boxes = int(books_ordered // books_per_box) 14 print("We will need", num_boxes, "Standard boxes.", end='') 15 16 #compute how many books are left over, and then print the final message 17 books_left =int(books_ordered % books_per_box) 18 print("There will be", books_left, "books left to ship in a smaller box. ") 19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!