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

!!! Please expalin each line of code and use Java !!! Write a program that reads

ID: 3803796 • Letter: #

Question

!!! Please expalin each line of code and use Java !!!

Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas: 1. Bottom area = Radius * Radius * 3.14 2. Cylinder Volume = Bottom Area * Length 3. Cylinder area = (2 * Radius * 3.14 * Length) + (2 * Bottom area) Your program should prompt the user to enter the radius and length of a cylinder. The program should output the length and radius of the cylinder along with the area and volume of the cylinder. Limit the output values to two decimal places.

Explanation / Answer

THE BELOW FILE USES SEMANTIC AND SYNTAX OF C++
//header files
#include <iostream>
#include <iomanip>
//supplying namespace to the file
using namespace std;
//main function to drive the program
int main(){
float length, radius;
cout<<"Enter the value of length of the cylinder"<<endl;//A simple cout statement to ask user for length
cin>>length;//Get the value of length and assign it to the variable length

cout<<"Enter the value of radius of the cylinder"<<endl;//A simple cout statement to ask user for radius
cin>>radius;//Get the value of radius and assign it to the variable radius

float bottomArea = radius * radius * 3.14; //calculating bottom area
float cylinderVolume = bottomArea * length; //calculating volume of the cylinder
float cylinderArea = (2 * radius * 3.14 * length) + (2 * bottomArea); //calculating area of the cylinder

cout<<fixed;//sets precision to fixed type to ensure setprecision() works
cout<<"The value of Cylinder's radius is: "<<setprecision(2)<< radius <<endl; //DISPLAYS THE OUTPUT TO THE PRECISION OF 2
cout<<"The value of Cylinder's length is: "<<setprecision(2)<< length <<endl; //DISPLAYS THE OUTPUT TO THE PRECISION OF 2
cout<<"The value of Cylinder's volume is: "<<setprecision(2)<< cylinderVolume <<endl; //DISPLAYS THE OUTPUT TO THE PRECISION OF 2
cout<<"The value of Cylinder's area is: "<<setprecision(2)<< cylinderArea <<endl; //DISPLAYS THE OUTPUT TO THE PRECISION OF 2


return 0;
}

HOPE THIS HELPS,

FEEL FREE TO COMMENT AND RATE