 # Answered! Area Calculator: Write a program to calculate the area of some simple geometric shapes. The shapes required to be…

Area Calculator: Write a program to calculate the area of some simple geometric shapes. The shapes required to be included are rectangles, circles, and right triangles. Because we have not covered conditional code yet, we will calculate all the shapes in order. Your program must:  Ask the user for the values necessary to compute the area of each shape o Rectangle o Circle  You must use an accurate value of pi (3.14159265359) o Right Triangle o The input must accept non-whole numbers  Display the results to the user  You do not need to attempt to make the program correct for improper input (e.g. negative numbers or non-numbers)

PROGRAM CODE:

#include <iostream>
using namespace std;
#define pi 3.14159265359

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Area Calculator: Write a program to calculate the area of some simple geometric shapes. The shapes required to be…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

void rectangleArea(double l, double w)
{
cout<<“nArea of the rectangle is “<<l*w<<endl;
}

void circleArea(double r)
{
cout<<“nArea of the circle is “<<(pi*r*r)<<endl;
}

void rightTriangleArea(double h, double b)
{
cout<<“nArea of the right triangle is “<<h*b/2<<endl;
}
int main() {

cout<<“Calculating area for rectangle…”<<endl;
cout<<“Enter length: “;
cin>>length;
cout<<“nEnter width: “;
cin>>width;
rectangleArea(length, width);

cout<<“nCalculating area for circle…”<<endl;

cout<<“nCalculating area for right triangle…”<<endl;
cout<<“Enter base: “;
cin>>width;
cout<<“nEnter height: “;
cin>>length;
rightTriangleArea(length, width);

return 0;
}

OUTPUT:

```Calculating area for rectangle...
Enter length: 10
Enter width: 20
Area of the rectangle is 200

Calculating area for circle...