# note which line the user inputs and presses enter• area = radius * radius * pi• volume = area * lengthSample Run:Enter the radius and length of a cylinder: 5.5 12The area is 95.0331The volume is 1140.4

Question
33 views

note which line the user inputs and presses enter
• volume = area * length
Sample Run:
Enter the radius and length of a cylinder: 5.5 12
The area is 95.0331
The volume is 1140.4

check_circle

Step 1

The algorithm for the program would be as below:

1. Declare 4 float variables for accepting user input and computing the output
2. Declare a static constant float variable to hold the constant value of Pi
3. Prompt the user for the input
4. Accept the user input into floating point data types
5. Compute the area and volume using formula given and assign them to float variables
6. Print the value of area and volume as required.

We use the Scanner class from the util package of java to accept user input.

Step 2

The java program is given below:

import java.util.*;

public class CylinderCalculator{

private static final float PI = 3.14159f;

public static void main(String[] args) {

float area, volume;

System.out.println("Enter the radius and length of a cylinder:");

&...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

### Programing 