Taxes Owed Program in a Function. Create a Python program named hw2-2 that does and works as follows: • In the main part of the program, prompt the user for a product price and save their input into a...

Taxes Owed Program in a Function. Create a Python program named hw2-2 that does and works as follows: • In the main part of the program, prompt the user for a product price and save their input into a float variable. • Next in the main, call a user-defined function and pass the product price variable into this function. • Inside the user-defined function, do these three things: o Create a constant named SALES_TAX and assign it a value of .06 o Create a variable to store the sales tax amount and set it equal to the sales tax constant times (multiplied by) the product price passed into the function o Output the amount of taxes. Your program should run just like the sample run but allow any float user input amount for product price and then calculate the correct amount of taxes. Sample run: Please enter the product price: $100 Taxes are: $6.00. Program organization: Process and Output User input (1) Function call 3. Rectangle Area with Two Functions Program. Create a Python program named hw2-3.py with two user-defined functions and works in the following way: a. The main part of the program will call a function two times. b. This first function will prompt the user to enter the length of the side of a rectangle (as a float data type). Return the length value to the main part of the program. a. Call this function twice to get the length of the two sides needed for the calculation. b. See sample run below. Figuring out how to display #1 and #2 on these lines is optional. Note: Do not code the function to ask for two user inputs. The function will only ask the user for one input. The function will be called twice from the main to get the two user inputs/sides. c. The main part of the program will then call the second function, passing into it the two side lengths. d. The second function will then calculate and display the area of the rectangle (round the output to one digit to the right of the decimal place) based on two side lengths entered by the user. e. Use the tab escape character to align the user input and output as shown in the sample run below. Sample run: Please enter length of side #1: 2 Please enter length of side #2: 3 The area of the rectangle is: 6.0 Program organization: User Input Process and Output Function call (get side 1) Function call (get side 2) Function call (calculate area) User-Defined Function User-Defined Function User-Defined Function 4. Add Drawing of Rectangle to Programs #3. Create a Python program named hw2-4.py that begins with a copy of program hw2-3.py. Then, add a third user-defined function accepts in the two side values as parameters and outputs a drawing of the rectangle that is the size of the user input values using the Python Turtle library. In other words, the third function will draw the rectangle. Sample Run: Please enter length of side #1: 100 Please enter length of side #2: 200 The area of the rectangle is: 20000 5
Oct 03, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here