Hey so I'm taking a intro to java class and I'm told to (Computing the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas:
area = r*r*pi
volume= area*length
In the end the program is suppose to say "The area is...The volume is..."
This is what I have so far but I am totally lost. Also let me know if it should use another way to show my code vs copy and paste. Please let me know what I am doing wrong.
import java.util.Scanner;
public class VolumeOfACylinder {
public static void main(String[] args){
// area = radius * radius * 3.14159
Scanner scum = new Scanner(System.in);
double radius = scum.nextDouble();
System.out.println("Please enter the radius: ");
double area;
area = radius * radius * 3.14159;
// volume = area * length
Scanner solo = new Scanner(System.in);
double area;
double lenth = solo.nextDouble();
System.out.println("Please enter the length: ");
double volume;
volume = area * length;
System.out.println("The area is " + area + "and the volume is " + area * length );
}
}