Question: IN C# Write a program that calculates and displays the area of a shape. In function main, the user is prompted to choose for which
IN C# Write a program that calculates and displays the area of a shape.
In function main, the user is prompted to choose for which
shape circle square or triangle the area will be calculated.
Based on the user's shape selection, the program will call one of
three functions circle square or triangle and the user is
then prompted for input of relevant dimensions.
For example, if circle is selected, the circle function is
called and the user is prompted for radius input.
The area calculation and dimensions input should be handled by whichever
of the three functions is called: circle, square or triangle.
The general template is given below, along with hints in the comments.
#include...
float circle;
float square;
float triangle;
int main
return ;
FUNCTION: circle
PURPOSE:
PARAMETERS:
RETURNS:
float circle
create a variable for radius
prompt for radius as user input
save radius to the variable
return calculate and return area as R R or whatever you named your radius variable
FUNCTION: square
PURPOSE:
PARAMETERS:
RETURNS:
float square
follow the same plan as for circle, but prompt for side instead
of radius and return area calculated as side side
return
FUNCTION: triangle
PURPOSE:
PARAMETERS:
RETURNS:
float triangle
area base height, so you will need to prompt for
two variablas as user input and save each in a separate
variable you already created
return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
