Just for Java Learning
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

27 linhas
757 B

  1. package tutorial;
  2. import java.util.Scanner;
  3. public class CalVolOfCylinder {
  4. public static void main (String [] args)
  5. {
  6. String strRadius , strLength;
  7. double radius , length, volume;
  8. Scanner input = new Scanner(System.in);
  9. System.out.print("Enter the radius: ");
  10. strRadius = input.nextLine();
  11. System.out.print("Enter the length: ");
  12. strLength = input.nextLine();
  13. radius = Double.parseDouble(strRadius);
  14. length = Double.parseDouble(strLength);
  15. volume = Math.pow(radius,2) * Math.PI * length;
  16. System.out.println("The volume of the cylinder with radius= " + radius + " and length= " + length + " is " + volume + ".");
  17. }
  18. }