Question: Create the following program: *Create a python program to calculate the area and circumference of a rectangle using the following functions: *main: o Function that

Create the following program:

*Create a python program to calculate the area and circumference of a rectangle using the following functions:

*main:

o Function that is executed first to start the program

o Create two variables length and width used for input of float numbers (see output below)

o Create variable strOperation used for input to ask user whether to calculate area (a) or circumference (c) (see output below)

o Print a welcome message (see output below)

o Call function fOperation (see below) passing strOperation and length and width

o Print out result (see output below)

fOperation(pOperation, pLength, pWidth):

o Test parameter pOperation whether it is a or c

*Call either function fCalcArea(pLength, pWidth) or fCalcCircumference(pLength, pWidth)

o Populate strOutput with either the string The area of the rectangle = or The circumference of the rectangle = and the result of the operation (either area or circumference)

o Return strOutput

fCalcArea(pLength, pWidth):

o Perform the calculation of the area (width * length) and return the result

fCalcCircumference(pLength, pWidth) o Perform the calculation of the circumference (2 * (width + length) and return the result

Area: Circumference:

 Create the following program: *Create a python program to calculate the

Create the following program: Create a program to caleulate the area and circumference of a rectangle using the following functions: uin: Function that is executed first to start the program Create two variables lengath and width used for input of float numbers (see output below) Create variable stzOperation used for input to ask user whether to ealculate arca (a) or cincumference (c) (see output below) Print a weleome message (see output below) Call function fOperation (see below) passing strOperation and fength and width Print out result (see output below) fOperation(pOperation, plecngth, pWidth): Test parameter pOperation whether it is " a44 or "e" - Call cither function fCalcArca(plength, pWidh) or fCalcCircumference(plength, pWideh) Populate strOutput with either the string "The area of the rectangle = " or "The circumference of the rectangle =" and the result of the operation (either area of circumference) Return stroutput fCalcArea(pleength, pWidth): Perform the calculation of the area (width * length) and return the resula fCalcCircumference(plength, pWidth) Perform the calculation of the circumference (2 (widhh + length) and reham the result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!