Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please can you use C++ answer the question without explanation just I need thecode. Write a program that calculates the area of a 2D geometric
please can you use C++
answer the question without explanation just I need thecode.
Write a program that calculates the area of a 2D geometric shape. The program will read three values: first one is the shape's name (shapeName) as a char, second and third values are the dimensions of the shape (dimensionA, dimensionB) as two doubles. Then, your program MUST use a function named "getArea" to calculate the area of the given shape. The function will take 3 parameters, first parameter will be a char containing the first letter of the shape's name, second and third parameters will be doubles containing dimensions of the shape (i.e. radiuses of an ellipse or base and height lengths of a rectangle or triangle). The function should return the area of the shape as a double. After calling the function, your program should print out the area of the given shape as a double value. NOTE: For the area of ellipse, assume pi 3.14. NOTE: shapeName van ONLY be 'E', 'T', or 'R', meaning ellipse, rectangle and triangle respectively. HINT: a b Area (b*h)/2 b Area =bsh Area = xaxb Input E 5.3 4.8 T 5.2 8.4 E 1.2 4.56 T 45.12 0.44 R 4.7 7.2 Output 79.8816 21.84 17.1821 9.9264 33.84
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