Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Create the following program:

*Create a 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:

image text in transcribed
Create the following program: Create a program to calculate the area and circumference of a rectangle using the following functions: main: Function that is executed first to start the program Create two variables length and width used for ingut of float numbers (see output below) Create variable strOperation used for input to ask user whether to calculate area (a) or circumference (c) (sec outpur below) Print a weleome message (see output below) Call function fOperation (see below) passing strOperation and length and width Print out result (see output below) Eoperation(pOperation, plength, pWidth): Test parameter pOperation whether it is " a " or " c - Call cither function fCalcArea(plength, pW idth) or fCaleCircumaference(pLength, pWidth) Populate strOutput with either the string "The area of the reetangle = " or "The circumference of the fectasgle =" and the result of the operation (either area or circumfereace) Retarn stuOutput fCaleArea(plength, pWidth) o Perform the calculation of the area (width * length) and return the result ECalcCircumference(pLength, pWidth) o Perform the calealation of the circumference (2 (width + length) and retum the result Atsa: Circumference: Upload the following files to Canvas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

Explain Industrial market segment.

Answered: 1 week ago