For this program you will complete a "rectangle simulator" program that uses four functions you will write. The full program has been written below - all you need to do is successfully write the four functions described here. Refer to the IPO notation below when writing these functions (note: you can just copy the IPO directly into your code to document your functions): # function: compute_area_of_rectangle # input: length (integer) and width (integer) # processing: computes the area of the described rectangle # output: returns the area of the described rectangle (integer) # function: compute_perimeter_of_rectangle # input: length (integer) and width (integer) # processing: computes the perimeter of the described rectangle # output: returns the perimeter of the described rectangle (integer) # function: draw_rectangle # input: length (integer) and width (integer) # processing: constructs the rectangle using a series of "*" characters (see below for a sample 4 by 3 rectangle:) # *** # *** # *** # *** # output: returns the rectangle (string) This next function is used to encapsulate an input validation loop -- so you can get input and validate it all in one function call. # function: get_input # input: a prompt to ask the user (String), a low value (integer) and a high value (integer) # processing: continually prompts the user for input, using the supplied prompt. if the user does # not enter an integer within the defined range the function will re-prompt them # output: returns the integer the user supplied (int) Here is the code for the main body of your program. Once you've written the above functions, paste this code into your Python file and the program should run using your functions. length = get_input("Enter a length between 3 and 10", 3, 10) width = get_input("Enter a width between 3 and 10", 3, 10) area = compute_area_of_rectangle(length, width) perim = compute_perimeter_of_rectangle(length, width) print ("Area:", area, "; Perim:", perim) rect = draw_rectangle(length, width) print (rect) Note: Take a careful look at the IPO specification for the draw_rectangle function. It is supposed to return a string, which is the "image" of the rectangle. You're not supposed to print within the function -- instead you should return the fully composed string so the calling code can print it. This is going to be true for almost all functions I specify in this course, and is generally how you will use functions in programming. Almost always, you'll have functions that put together the information for output, and you will do the actual output somewhere else in the program.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
For this program you will complete a "rectangle simulator" program that uses four functions you will write. The full program has been written below - all you need to do is successfully write the four functions described here. Refer to the IPO notation below when writing these functions (note: you can just copy the IPO directly into your code to document your functions): # function: compute_area_of_rectangle # input: length (integer) and width (integer) # processing: computes the area of the described rectangle # output: returns the area of the described rectangle (integer) # function: compute_perimeter_of_rectangle # input: length (integer) and width (integer) # processing: computes the perimeter of the described rectangle # output: returns the perimeter of the described rectangle (integer) # function: draw_rectangle # input: length (integer) and width (integer) # processing: constructs the rectangle using a series of "*" characters (see below for a sample 4 by 3 rectangle:) # *** # *** # *** # *** # output: returns the rectangle (string) This next function is used to encapsulate an input validation loop -- so you can get input and validate it all in one function call. # function: get_input # input: a prompt to ask the user (String), a low value (integer) and a high value (integer) # processing: continually prompts the user for input, using the supplied prompt. if the user does # not enter an integer within the defined range the function will re-prompt them # output: returns the integer the user supplied (int) Here is the code for the main body of your program. Once you've written the above functions, paste this code into your Python file and the program should run using your functions. length = get_input("Enter a length between 3 and 10", 3, 10) width = get_input("Enter a width between 3 and 10", 3, 10) area = compute_area_of_rectangle(length, width) perim = compute_perimeter_of_rectangle(length, width) print ("Area:", area, "; Perim:", perim) rect = draw_rectangle(length, width) print (rect) Note: Take a careful look at the IPO specification for the draw_rectangle function. It is supposed to return a string, which is the "image" of the rectangle. You're not supposed to print within the function -- instead you should return the fully composed string so the calling code can print it. This is going to be true for almost all functions I specify in this course, and is generally how you will use functions in programming. Almost always, you'll have functions that put together the information for output, and you will do the actual output somewhere else in the program.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education