Instructions (Please see attached for more detailed instruction's ) The included program found in main.cpp is designed to find the area of a rectangle, the area of a circle, or the volume of a...

1 answer below »


Instructions (Please see attached for more detailed

instruction's
)


The included program found inmain.cppis designed to find the area of a rectangle, the area of a circle, or the volume of a cylinder.


However:



  • the statements are in the incorrect order;

  • the function calls are incorrect;

  • the logical expression in the while loop is incorrect;

  • the function definitions are incorrect;

  • You may assume that the value of π =3.14159.


Rewrite the program so that it works correctly. Your program must be properly indented. (Note that the program is menu driven and allows the user to run the program as long as the user wishes.)


Format your output withsetprecision(2)to ensure the proper number of decimals for testing!




Instructions The included program found in main.cpp is designed to find the area of a rectangle, the area of a circle, or the volume of a cylinder. However: · the statements are in the incorrect order; · the function calls are incorrect; · the logical expression in the while loop is incorrect; · the function definitions are incorrect; · You may assume that the value of π = 3.14159. Rewrite the program so that it works correctly. Your program must be properly indented. (Note that the program is menu driven and allows the user to run the program as long as the user wishes.) Format your output with setprecision(2) to ensure the proper number of decimals for testing! This is the main.cpp code is to work with: #include  using namespace std; const double PI = 3.14159; double rectangle(double l, double w); #include  int main() {     double radius;     double height; cout <><><>< endl;>< "this program can calculate the area of a rectangle, "><>< endl;><>< endl;><>< endl;><>< endl;><>< endl;><>< endl;     cin ="">> choice;     cout < endl;     int choice;=""     while (choice ="= –1)"     {=""         {=""         case 1: ="">< "enter the radius of the base and the ">< "height of the cylinder: ";             cin ="">> radius >> height;             cout < endl;><><>< endl;             break;=""         case 3:=""             double length, width;="">< "enter the radius of the circle: ";             cin ="">> radius;             cout < endl;><>< rectangle(radius)>< endl;             break;=""         case 2:="">< "enter the length and the width ">< "of the rectangle: ";             cin ="">> length >> width;             cout < endl;><>< cylinder(radius, height) >< endl;             break;=""         default:=""><>< endl;         }=""         switch (choice)=""     }=""     double circle(double r)=""     double cylinder(double br, double h);=""><>< endl; ><>< endl;><>< endl;><>< endl;><>< endl;     cin ="">> choice;     cout < endl;     return 0;  } double rectangle(double l, double w) {     return l * r; } double circle(double r) {     return pi * r * w; } double cylinder(double br, double h) {     return pi * br * br * l; } this is what the run checks looks for in the grading: tasks 0.00 out of 10.00 program outputs correctly 1 0 out of 1 checks passed. review the results below for more details. checks test caseincomplete successful output i input 1 5 6 2 4 3 2 4 -1 output results 30 50.27 50.27     return 0;=""  }="" double rectangle(double l, double w)="" {=""     return l * r;="" }="" double circle(double r)="" {=""     return pi * r * w;="" }="" double cylinder(double br, double h)="" {=""     return pi * br * br * l;="" }="" this="" is="" what="" the="" run="" checks="" looks="" for="" in="" the="" grading:="" tasks="" 0.00="" out="" of="" 10.00="" program="" outputs="" correctly="" 1="" 0="" out="" of="" 1="" checks="" passed.="" review="" the="" results="" below="" for="" more="" details.="" checks="" test="" caseincomplete="" successful="" output="" i="" input="" 1="" 5="" 6="" 2="" 4="" 3="" 2="" 4="" -1="" output="" results="" 30="" 50.27="">
Answered Same DayNov 06, 2021

Answer To: Instructions (Please see attached for more detailed instruction's ) The included program found in...

Sathishkumar answered on Nov 07 2021
118 Votes
#include
#include
using namespace std;
const double PI = 3.14159;
double le
ngth;
double width;
double radius;
double height;
int choice;
double rectangle(double l, double w);
double circle(double r);
double cylinder(double bR, double h);
int main()
{
    

while (choice!=-1)
{
    cout << fixed << showpoint << setprecision(2);
    cout << "This program can calculate the area of a rectangle, " << "the area of a circle, or volume of a cylinder." << endl;
cout << "To run the program enter: " << endl;
cout << "1: To find the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here