Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is my current program: I need to convert it to the above assignment. Please

ID: 3531748 • Letter: T

Question


This is my current program: I need to convert it to the above assignment. Please help.

//main.cpp

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

#include "cylinderObjects.h"

int main ()
{
Cylinder cylinderOne(10.0,10.0);
cout << "cylinder 1 radius:" << cylinderOne.getRadius()<<endl;
cout << "cylinder 1 height:" << cylinderOne.getHeight()<<endl;
cout << "cylinder 1 volume:" << cylinderOne.volume() <<endl;
cout << "cylinder 1 endArea:"<< cylinderOne.endArea()<<endl;
return 0;
}


//cylinder.cpp

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include "cylinderObjects.h"

using namespace std;

Cylinder::Cylinder()
{
myRadius = 0;
myHeight = 0;
}
Cylinder::Cylinder (double r, double h)
{
myRadius=r;
myHeight=h;
}

double Cylinder::getRadius()
{
return myRadius;
}

double Cylinder::getHeight()
{
return myHeight;
}

void Cylinder::setmyRadius(double r)
{
myRadius=r;
}

void Cylinder::setmyHeight(double h)
{
myHeight=h;
}
// calculations
double Cylinder::sideArea()
{
return volume() * 2 * PI * myHeight * myRadius;
}
double Cylinder::endArea()
{
return PI* myRadius * myRadius;
}

double Cylinder::volume()
{
double cylinderVolume;
cylinderVolume = endArea() * myHeight;
return cylinderVolume;
}


//cylinderobjects.cpp

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

const double PI = 3.14159;

class Cylinder
{
private:
double myRadius; // data member
double myHeight; // data member
public:
Cylinder(); // member function (constructor)
Cylinder(double myRadius, double myHeight);

double getRadius();
double getHeight();
void setmyRadius(double r);
void setmyHeight(double h);
double endArea ();
double sideArea();
double volume();
}; // end of class declaration

Explanation / Answer

This is a c++ cylimder program (I am answering this because only 7 min left to answer and I must post something before that time to get rated... I will submit actual answer in 15-20 mins please wait and rate me once I answer)



#include<iostream>
#include<cmath>
using namespace std;

int main()
{
//pi*r^2*h

doublepi= 3.14, r, h, volume;

cout << "Please enter the height." << endl;
cin >> h;

cout << "Please enter the radius." << endl;
cin >> r;

volume = pi * pow(r,2) * h;

cout << "The volume of the cylinder is " << volume << "." << endl;

system ("PAUSE");

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote