Question

In: Computer Science

Write a program that reads in the radius and length of a cylinder and computes volume...

  1. Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas:

area = radius * radius * PI

volume = area * length

Solutions

Expert Solution

//Program:

#include<iostream>
using namespace std;
int main()
{
   int radius, length;
   float area, volume;
   cout<<"Enter the radius:";
   cin>>radius;                 //reading the radius
   cout<<"Enter the length:";
   cin>>length;                 //reading the length
   area=radius*radius*3.14;     //calculating the area
   volume=area*length;          //calculating the volume
   cout<<"Area:"<<area<<endl;    //printing the area
   cout<<"Volume:"<<volume;      //printing the volume
   return 0;
}

//Output:


Related Solutions

Write a program that reads the radius of a sphere and calculates it's volume and surface...
Write a program that reads the radius of a sphere and calculates it's volume and surface area. Format results to 4 decimal places. The radius=3.2 Your program should output volume and surface area.  Repeat same steps for program2, but this time use the following input values: a= ꟷ2.4 , b = 4.5 . Your program should output sum, Fun1, and Fun2. It's for C++
Write an application, CylinderStats, that reads the radius and height of a cylinder and prints its...
Write an application, CylinderStats, that reads the radius and height of a cylinder and prints its surface area and volume. Use the following formulas. Print the output to five decimal places. In the formulas, represents the radius and the height.Surface are 2πr(r+ h) Volume:πr2h Design and implement a class Cylinder that contains instance data that represents the cylinder’s radius and height. Define a Cylinder constructor to accept and initialize the radius and height.Include getter and setter methods for all instance...
Write a defining table and a computer program that computes and outputs the volume of a...
Write a defining table and a computer program that computes and outputs the volume of a torus with inner radius a and outer radius b. A doughnut is an example of a torus. Your program must read the inner radius and outer radius from two text fields and display the volume in a div. The formula for the volume of a torus is v =  π2(a + b)(a - b)2 4 where v is the volume, π is the constant pi,...
There is a long cylinder magnet with inner radius of R1 outher radius of R2 length...
There is a long cylinder magnet with inner radius of R1 outher radius of R2 length of L and magnetization of M=MoZ for R1<rR2 Calculate B and H everywhere Claculate bound surface Calculate the magnetic vector potential everywhere Calculate B again along z axis by assuming the cylindircal magnet is short What is the electrostatic equivalent of this structure
A cylindrical capacitor consists of a cylinder (of length L and radius a) with a total...
A cylindrical capacitor consists of a cylinder (of length L and radius a) with a total charge Q nested inside a thin conducting cylindrical shell (of length L and radius b) with total charge
There is uniformly charged hollow cylinder The cylinder has radius R, length L, and total charge...
There is uniformly charged hollow cylinder The cylinder has radius R, length L, and total charge Q. It is centered on the z-axis, with one end at z=−L/2 and the other at z=+L/2.We are interested in finding the electric field generated by the cylinder at a point P located on the z-axis at z=z0. -Consider a thin ring segment of the cylinder, located at height z and having thickness dz. Enter an expression for the charge dQ of the ring?...
The volumetric charge density in a cylinder with a radius of infinite length changes from the...
The volumetric charge density in a cylinder with a radius of infinite length changes from the axis to ?? = ??. Here k is a constant. Find the electric field inside (r <a) and outside   (r> a) of the cylinder.
In Python b) Modify your program that reads 3 grades from the user (and computes the...
In Python b) Modify your program that reads 3 grades from the user (and computes the average and letter grade) so that it uses a while loop to read the 3 grades. In the loop body, you will just read one grade and update other variables appropriately. The loop header will ensure 3 iterations. c) Modify your program in part b so that it asks the user how many grades there are and uses a while loop to read that...
The volume of a right circular cylinder with base radius ? and height ℎ is given...
The volume of a right circular cylinder with base radius ? and height ℎ is given by: ? = ??^2ℎ. If the base radius is decreasing at a rate of 3 inches per minute and the height is increasing at a rate of 2 inches per minute, at what rate is the volume of the cylinder changing when the radius is 8 inches and the height is 3 inches. Will the volume be increasing or decreasing at this instant? Be...
Write an application that reads three integers, adds all three together and computes an average of...
Write an application that reads three integers, adds all three together and computes an average of the three entries and computes any remainder of the integer division. A remainder represents the modulus result of dividing an even by an odd number or vice versa. Display the output. Enter an integer score 3 Enter an integer score 6 Enter an integer score 4 The average of 3, 6, 4 is 4 with a remainder of 1 Press any key to continue...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT