Question
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:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started