Instructions The statements in the file main.cpp are in incorrect order. Rearrange the statements so that they prompt the user to input: The shape type (rectangle, circle, or cylinder) The appropriate...

1 answer below »

Instructions


The statements in the filemain.cppare in incorrect order.


Rearrange the statements so that they prompt the user to input:



  • The shape type (rectangle, circle, or cylinder)

  • The appropriate dimension of the shape.



Note: For grading purposes place the cylinder height statement before the radius statement.



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

  • For a cylinder, it outputs the volume and surface area.



Use3.1416as the constant value for any calculations that may need\piπ.



After rearranging the statements, your program should be properly indented.


Please see attached detaild instructions.




Instructions The statements in the file main.cpp are in incorrect order. Rearrange the statements so that they prompt the user to input: · The shape type (rectangle, circle, or cylinder) · The appropriate dimension of the shape. Note: For grading purposes place the cylinder height statement before the radius statement. 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 · For a cylinder, it outputs the volume and surface area. Use 3.1416 as the constant value for any calculations that may need \piπ. After rearranging the statements, your program should be properly indented. This is what the checks look for: 0.00 out of 10.00 Correct output for test cases 3 0 out of 3 checks passed. Review the results below for more details. Checks Test CaseIncomplete Rectangle test case 1 Input rectangle 60 33 Output Results 1980.00 186.00 Show Details Test CaseIncomplete Circle test case 1 Input circle 55 Output Results 9503.34 345.58 Show Details Test CaseIncomplete Cylinder test case 1 Input cylinder 90 3 Output Results 2544.70 1753.01 Show Details Run ChecksSubmit 0% Here is the code that is given to start with: using namespace std; #include  int main() {     string shape;     double height;     #include           cout < "enter the shape type: (rectangle, circle, cylinder) ";     cin ="">> shape;     cout < endl;     =""     if (shape ="= "rectangle")"     {="">< "area of the circle = "><>< endl;         ="">< "circumference of the circle: "><>< endl;         ="">< "enter the height of the cylinder: ";         cin ="">> height;         cout < endl;         ="">< "enter the width of the rectangle: ";         cin ="">> width;         cout < endl;         ="">< "perimeter of the rectangle = "><>< endl;         double width;=""     }=""     ="">< "surface area of the cylinder: ">< 2 * pi * radius * height + 2 * pi * pow(radius, 2.0)>< endl;     }=""     else if (shape ="= "circle")"     {="">< "enter the radius of the circle: ";         cin ="">> radius;         cout < endl;         ="">< "volume of the cylinder = "><>< endl;         double length;=""     }=""     return 0;=""     else if (shape ="= "cylinder")"     {=""         double radius;=""         ="">< "enter the length of the rectangle: ";         cin ="">> length;         cout < endl;         ="">                  cout < "enter the radius of the base of the cylinder: ";         cin ="">> radius;         cout < endl;         =""         const double pi =" 3.1416;">< "area of the rectangle = "><>< endl;     else=""><><>< endl;><><>< setprecision(2);> } Instructions The statements in the file main.cpp are in incorrect order. Rearrange the statements so that they prompt the user to input: · The shape type (rectangle, circle, or cylinder) · The appropriate dimension of the shape. Note: For grading purposes place the cylinder height statement before the radius statement. 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 · For a cylinder, it outputs the volume and surface area. Use 3.1416 as the constant value for any calculations that may need \piπ. After rearranging the statements, your program should be properly indented. This is what the checks look for: 0.00 out of 10.00 Correct output for test cases 3 0 out of 3 checks passed. Review the results below for more details. Checks Test CaseIncomplete Rectangle test case 1 Input rectangle 60 33 Output Results 1980.00 186.00 Show Details Test CaseIncomplete Circle test case 1 Input circle 55 Output Results 9503.34 345.58 Show Details Test CaseIncomplete Cylinder test case 1 Input cylinder 90 3 Output Results 2544.70 1753.01 Show Details Run ChecksSubmit 0% Here is the code that is given to start with: using namespace std; #include  int main() {     string shape;     double height;     #include           cout < "enter the shape type: (rectangle, circle, cylinder) ";     cin ="">> shape;     cout < endl;     =""     if (shape ="= "rectangle")"     {="">< "area of the circle = "><>< endl;         ="">< "circumference of the circle: "><>< endl;         ="">< "enter the height of the cylinder: ";         cin ="">> height;         cout < endl;         ="">< "enter the width of the rectangle: ";         cin ="">> width;         cout < endl;         ="">< "perimeter of the rectangle = "><>< endl;         double width;=""     }=""     ="">< "surface area of the cylinder: ">< 2 * pi * radius * height + 2 * pi * pow(radius, 2.0)>< endl;     }=""     else if (shape ="= "circle")"     {="">< "enter the radius of the circle: ";         cin ="">> radius;         cout < endl;         ="">< "volume of the cylinder = "><>< endl;         double length;=""     }=""     return 0;=""     else if (shape ="= "cylinder")"     {=""         double radius;=""         ="">< "enter the length of the rectangle: ";         cin ="">> length;         cout < endl;         ="">                  cout < "enter the radius of the base of the cylinder: ";         cin ="">> radius;         cout < endl;         =""         const double pi =" 3.1416;">< "area of the rectangle = "><>< endl;     else=""><><>< endl;><><>< setprecision(2);> }
Answered Same DayOct 09, 2021

Answer To: Instructions The statements in the file main.cpp are in incorrect order. Rearrange the statements so...

Sathishkumar answered on Oct 10 2021
125 Votes
#include
#include
#include
#include
using namespace std;
int main()
{
string shape;
double height;
double length;
    double width;
    double radius;
const double PI = 3.1416;
    
cout << "Enter the shape type: (rectangle, circle, cylinder) ";
cin >> shape;
cout << endl;

if (shape == "rectangle")
{
    
    cout << "Enter the length of the rectangle: ";
cin >> length;
cout << endl;

        cout << "Enter the width of the rectangle:...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here