Answered step by step
Verified Expert Solution
Link Copied!

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.image text in transcribed

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

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

What are Dysons goals and objectives?

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

How are interest rates used to allocate capital among firms?

Answered: 1 week ago