Based on the image attached, shows a statement of a program are in the incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, your program should be properly indented.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question
100%

EXERCISE WEEK 7 (USE C++ CODING)

Based on the image attached, shows a statement of a program are in the incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, your program should be properly indented.

cout << "Volume of the cylinder = "
<« PI * pow(radius, 2.0)* height << endl;
double length;
}
return 0;
else if (shape == "cylinder")
{
double radius;
cout << "Enter the length of the rectangle: ";
cin >> length;
cout << endl;
#include <iomanip>
cout << "Enter the radius of the base of the cylinder: ";
cin >> radius;
cout << endl;
const double PI = 3.1416;
cout << "Area of the rectangle = "
<« length * width << endl;
else
cout << "The program does not handle "<< shape << endl;
cout << fixed << showpoint << setprecision(2);
#include <cmath>
}
Transcribed Image Text:cout << "Volume of the cylinder = " <« PI * pow(radius, 2.0)* height << endl; double length; } return 0; else if (shape == "cylinder") { double radius; cout << "Enter the length of the rectangle: "; cin >> length; cout << endl; #include <iomanip> cout << "Enter the radius of the base of the cylinder: "; cin >> radius; cout << endl; const double PI = 3.1416; cout << "Area of the rectangle = " <« length * width << endl; else cout << "The program does not handle "<< shape << endl; cout << fixed << showpoint << setprecision(2); #include <cmath> }
using namespace std;
#include <iostream>
int main()
{
string shape;
double height;
#include <string>
cout << "Enter the shape type: (rectangle, circle, cylinder) ";
cin >> shape;
cout << endl;
if (shape == "rectangle")
{
cout << "Area of the circle = "
<« PI * pow(radius, 2.0) << endl;
cout << "Circumference of the circle: "
<< 2 * PI * radius << endl;
cout << "Enter the height of the cylinder: ";
cin >> height;
cout << endl;
cout << "Enter the width of the rectangle: ";
cin >> width;
cout << endl;
cout << "Perimeter of the rectangle ="
< 2 * (length + width) << endl;
double width;
out << "Surface area of the cylinder:"
« 2 * PI * radius * height + 2 * PI * pow(radius, 2.0)
« end1;
}
else if (shape == "circle")
{
cout << "Enter the radius of the circle: ";
cin >> radius;
cout << endl;
Transcribed Image Text:using namespace std; #include <iostream> int main() { string shape; double height; #include <string> cout << "Enter the shape type: (rectangle, circle, cylinder) "; cin >> shape; cout << endl; if (shape == "rectangle") { cout << "Area of the circle = " <« PI * pow(radius, 2.0) << endl; cout << "Circumference of the circle: " << 2 * PI * radius << endl; cout << "Enter the height of the cylinder: "; cin >> height; cout << endl; cout << "Enter the width of the rectangle: "; cin >> width; cout << endl; cout << "Perimeter of the rectangle =" < 2 * (length + width) << endl; double width; out << "Surface area of the cylinder:" « 2 * PI * radius * height + 2 * PI * pow(radius, 2.0) « end1; } else if (shape == "circle") { cout << "Enter the radius of the circle: "; cin >> radius; cout << endl;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT