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): I function: # input: compute_area_of_rectangle length (integer) and width (integer) # processing: computes the area of the described rectangle # output: described rectangle (integer) returns the area of the # function: # input: compute perimeter_of_rectangle length (integer) and width (integer) # processing: computes the perimeter of the described rectangle returns the perimeter of the # output: described rectangle (integer) * function: draw_rectangle length (integer) and width # input: (integer) * processing: constructs the rectangle using a series of "*" characters (see below for a sample 4 by 3 rectangle:) *** * output: This next function is used to encapsulate an input validation loop -- so you can get input and validate it all in one function call. returns the rectangle (string) # function: # input: get_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 i output: returns the integer the user supplied (int) Here is the code for the main body of your program. Once you've writtenthe 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) - get_input ("Enter a width between 3 and 10", 3, 10) width = compute_area_of_rectangle (length, width) area 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.
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): I function: # input: compute_area_of_rectangle length (integer) and width (integer) # processing: computes the area of the described rectangle # output: described rectangle (integer) returns the area of the # function: # input: compute perimeter_of_rectangle length (integer) and width (integer) # processing: computes the perimeter of the described rectangle returns the perimeter of the # output: described rectangle (integer) * function: draw_rectangle length (integer) and width # input: (integer) * processing: constructs the rectangle using a series of "*" characters (see below for a sample 4 by 3 rectangle:) *** * output: This next function is used to encapsulate an input validation loop -- so you can get input and validate it all in one function call. returns the rectangle (string) # function: # input: get_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 i output: returns the integer the user supplied (int) Here is the code for the main body of your program. Once you've writtenthe 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) - get_input ("Enter a width between 3 and 10", 3, 10) width = compute_area_of_rectangle (length, width) area 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.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY