Question
PLEASE ANSWER ALL THESE QUESTIONS IN PYTHON, AN ALGORITHM AND A PROGRAM FOR EACH QUESTION PLEASE!!! QUESTION 1. Identical copies of a book are to
PLEASE ANSWER ALL THESE QUESTIONS IN PYTHON, AN ALGORITHM AND A PROGRAM FOR EACH QUESTION PLEASE!!!
QUESTION 1.
Identical copies of a book are to be packaged for shipping in cartons of standard capacity. The user provides the number of books. Each carton can hold 8 books. Only cartons that are completely filled are shipped. Write a program to show how many cartons will be shipped and how many books will be left over. Create an algorithm for a function that given input of the number of cartons and left over books will take care of just displaying the results with output similar to this text on one line: 6 cartons will be shipped and 2 books will remain. Depending on the numbers the message could be: 1 carton will be shipped and 1 book will remain. (The difference in the messages is one of singular and plural number.) Note that the computation of cartons and books will NOT be a part of the function. Assume those are computed already in the main program and are just inputs to the function which only handles displaying the result, i.e., the print statement. (You do not have to create the algorithm for the main program.) Is there any possible value to having a function just for displaying output as in this case? Is there any output from the function back to the main program in this case?
QUESTION 2.
UD classifies undergraduate students by credits completed. A student with less than 30 credits is a Freshman. At least 30 credits are required to be a Sophomore, 60 to be a Junior, and 90 to be a Senior. Display the classification based on the number of credits input by the user.
The algorithm now should use a function that accepts the number of credits from the main program and returns the classification to the program.
QUESTION 3.
Create an algorithm for a program that displays the results of multiplying the numbers in each set of five numbers entered by the user. The user should be able to provide as many sets of five numbers as desired i.e., the user should be asked (and can respond Yes or No) whether another set is to be entered. The program should also display the overall sum total of the results of all the multiplications. The prior algorithm should be restructured so that there is a separate function to handle just the entry of the set of numbers and their multiplication. The prior algorithm should be extended so that the set size is more flexible (i.e., not restricted to five numbers) and is specified by the user. Instead of asking the user whether another set is to be entered, the algorithm should ask how many numbers should be in the set to be multiplied. The user will enter 0 to signal that no more sets of numbers are to be provided.
QUESTION 4.
Write a program that compares two pizza offers and identifies the one with the better value, i.e., lower cost per square inch of pizza. The user should be able to input the size (i.e., diameter in inches) and cost of each pizza. Note that the area of a circle is 3.14 times the square of its radius (which is half of the diameter.) Avoid writing repetitive code for the computation, USING FUNCTION.
QUESTION 5.
The program should ask users for their last name, validate it (i.e., check it against business rules), and then display it as confirmation with only the first letter capitalized, e.g., John. If the name is not valid per our business rules, the display should be an appropriate error message instead and the user should be prompted for an input until a valid input is obtained. Each of these two rules for last names at our business should be structured as a separate function: Names must be no longer than 20 characters but must be at least two characters. Names may have an apostrophe (e.g., ORourke) and/or a hyphen (e.g., Smith-Barnes) but no other punctuation, no spaces, and no numbers. For example, we dont allow Smith Jr. (has space and period) or Smith III (has space). The program should also display how many times each of the two rules was violated before a valid input was obtained. USING FUNCTION.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started