#import math library #define functions #return type: float #Parameters: 2 floats(l and w) #This function returns the area of a rectangle with the given dimensions def RectangleArea(l,w): #return type: float #Parameters: 2 floats(l and w) #This function returns the perimeter of a rectangle with the given dimensions def RectanglePerimeter(l,w): #return type: float #Parameters: 1 floats(r) #This function returns the area of a circle with the given radius def CircleArea(r): #return type: float #Parameters: 1 floats(r) #This function returns the circumference of a circle with the given radius def CircleCircumference(r): #return type: None #Parameters: None #This function displays an introduction def Intro(): #return type: None #Parameters: 4 floats(rectArea, rectPer, circArea, circum) #This function displays the four values passed to it def PrintInfo(rectArea, rectPer, circArea, circum ): #return type: float #Parameters: None #This function prompts the user for a length(must be positive) and returns it def GetLength(): #local variables #float length #return type: float #Parameters: None #This function prompts the user for a width(must be positive) and returns it def GetWidth(): #local variables #float width #return type: float #Parameters: None #This function prompts the user for a radius(must be positive) and returns it def GetRadius(): #local variables #float radius def main(): #declare and initialize variables #float mylength, mywidth, myradius, myrectarea, myrectper, #mycircarea, mycircum mylength = 0.0 mywidth = 0.0 myradius = 0.0 myrectarea = 0.0 myrectper = 0.0 mycircarea = 0.0 mycircum = 0.0 #call(invoke) Intro function #call a function to prompt for a length and store in mylength #call a function to prompt for a width and store in myWidth #call a function to prompt for a radius and store in myradius #invoke a function to store the area of the rectangle in myrectarea #invoke a function to store the perimeter of the rectangle in myrectper #invoke a function to store the area of the circle in mycircarea #invoke a function to store the circumference of the circle in mycircum #call a function to display the results of the above calculations #call a function to display the area of a rectangle with dimensions 10 x 15 #call a function to display the area of a circle with radius 8 #call a function to display the perimeter of a rectangle with dimensions #20 x 12

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

FUNCTIONS PROBLEM

Find and fix the errors ( in PYTHON)

#import math library

#define functions

#return type: float
#Parameters: 2 floats(l and w)
#This function returns the area of a rectangle with the given dimensions
def RectangleArea(l,w):


#return type: float
#Parameters: 2 floats(l and w)
#This function returns the perimeter of a rectangle with the given dimensions
def RectanglePerimeter(l,w):

#return type: float
#Parameters: 1 floats(r)
#This function returns the area of a circle with the given radius
def CircleArea(r):

#return type: float
#Parameters: 1 floats(r)
#This function returns the circumference of a circle with the given radius
def CircleCircumference(r):

#return type: None
#Parameters: None
#This function displays an introduction
def Intro():

#return type: None
#Parameters: 4 floats(rectArea, rectPer, circArea, circum)
#This function displays the four values passed to it
def PrintInfo(rectArea, rectPer, circArea, circum ):

#return type: float
#Parameters: None
#This function prompts the user for a length(must be positive) and returns it
def GetLength():
#local variables
#float length


#return type: float
#Parameters: None
#This function prompts the user for a width(must be positive) and returns it
def GetWidth():
#local variables
#float width


#return type: float
#Parameters: None
#This function prompts the user for a radius(must be positive) and returns it
def GetRadius():
#local variables
#float radius

def main():
#declare and initialize variables
#float mylength, mywidth, myradius, myrectarea, myrectper,
#mycircarea, mycircum
mylength = 0.0
mywidth = 0.0
myradius = 0.0
myrectarea = 0.0
myrectper = 0.0
mycircarea = 0.0
mycircum = 0.0

#call(invoke) Intro function


#call a function to prompt for a length and store in mylength


#call a function to prompt for a width and store in myWidth

#call a function to prompt for a radius and store in myradius


#invoke a function to store the area of the rectangle in myrectarea

#invoke a function to store the perimeter of the rectangle in myrectper


#invoke a function to store the area of the circle in mycircarea


#invoke a function to store the circumference of the circle in mycircum

#call a function to display the results of the above calculations


#call a function to display the area of a rectangle with dimensions 10 x 15



#call a function to display the area of a circle with radius 8


#call a function to display the perimeter of a rectangle with dimensions
#20 x 12

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT