1/2CS170/02 Introduction to Python Programming – Fall 2020Week 3 AssignmentDue on Sunday, Sept. 20 at 11:59 p.m.Note: You are encouraged to discuss homework problems with other students, the tutors,...

1/2CS170/02 Introduction to Python Programming – Fall 2020Week 3 AssignmentDue on Sunday, Sept. 20 at 11:59 p.m.Note: You are encouraged to discuss homework problems with other students, the tutors, and theinstructor, but you must write your final answer by yourself. Solutions prepared “in committee” or bycopying someone else’s work are not acceptable.1. Cookie Order (Use the posted RestaurantBill.py as an example to code this program.)The Snookies Cookies shop sells cookies at $5.50 a pound plus the cost of shipping. Each orderships for $0.85 per pound + $1.75 fixed cost for overhead. Write a program that calculates thecost of an order.In the program, represent the numbers 5.50, 0.85, and 1.75 as named constants. Format theoutput results with two decimal places and a dollar sign front of the amount.Sample outputs:Step by step guide:Step 1: Declare the named constants to store the numbers 5.5, 0.85, and1.75. Naming them and assigning the values as follows:COOKIES_COST, UNITPRICE, FIXEDRATE = 5.5, 0.85, 1.75Declare the variables to store the number pounds of cookies ordered fromthe user, and declare another three variables to store the cookie cost,shipping fee, and total due.Step 2: Get the number pounds of cookies you want to order from the user.Step 3:a). Calculate the cost of cookies.b). Calculate the shipping fee.c). Calculate the total due.Step 4: Print the cost of cookies, shipping fee, and the total due on thescreen.2/22. Swapping Digits (Use the posted SummingDigits.py as an example to code this program.)Write a program that reads in an integer between 1 and 99, inclusive of 1 and 99. Theprogram swaps and prints the ones digit with the tens digit. It then also prints the double ofthe swapped integer. For example, if an integer entered is 93, the output should be: 2 × 39 =78. For another example, if an integer entered is 5, the output should be: 2 × 50 = 100.(Hint: Take the modulus (%) 10 of the user input to get the rightdigit, and then integer divide (//) the user input by 10 to get theleft digit.)Note that, for now, you will not worry about the situation where the input integer is out ofrange. You will assume that the user enters an integer is between 1 and 99 inclusive.Sample outputs shown below:Submission requirementsTo submit your assignment, you can do one of the following two options:Option 1:1). Compile and test your programs2). Zip the project folder which contains your two Python programs, and then upload thatzipped file on Canvas under weekly Assignments  Week #3 AssignmentOption 2:1). Compile and test your programs2). Upload the two *.py files on Canvas under Weekly Assignments  Week #3Assignment.
Sep 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here