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

Task : Write two short programs in C++. The first one will use procedural progra

ID: 3742290 • Letter: T

Question

Task: Write two short programs in C++. The first one will use procedural programming and the second one will use object-oriented programming (classes). Both programs will accept the radius and height of a right circular cylinder from the user and will calculate the volume and total surface area of the cylinder.

Program A: Use at least one function with the procedural program.

Program B: Declare a cylinder class, and then define an object that is an instance of that class. Create appropriate accessor and mutator functions for the class.

Both programs: Input at least 3 sets of radius/height data (within a loop), and for each set of data, display the radius, height, volume and surface area of the cylinder. The user may choose the input data.

Output: Both programs may display the results to the monitor.

Explanation / Answer

1) #include #include using namespace std; double volume(double r, double h) { return M_PI * r * r * h; } double area(double r, double h) { return (2 * M_PI * r) * (h + r); } int main() { double radius, height; for(int i = 0; i < 3; ++i) { cout > radius; cout > height; cout
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