satriafu5710

Luas & Volume Kerucut Java

Dec 7th, 2020 (edited)
2,270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. package com.tutorial;
  2. import java.util.Scanner;
  3. public class Main {
  4.    
  5.     public static void main(String[] args) {
  6.         Scanner userInput = new Scanner(System.in);
  7.         float phi = 3.14f;
  8.         float r, tinggi, s;  // s = Panjang Garis Pelukis
  9.         float luasP, volume;
  10.  
  11.         System.out.println("\t Hitung Luas Permukaan dan Volume Kerucut \n\n");
  12.  
  13.         System.out.print(" Masukkan Jari-jari     : ");
  14.         r = userInput.nextFloat();
  15.        
  16.         System.out.print(" Masukkan Tinggi        : ");
  17.         tinggi = userInput.nextFloat();
  18.  
  19.         System.out.print(" Masukkan Panjang Garis : ");
  20.         s = userInput.nextFloat();
  21.  
  22.         luasP = phi * r * (r + s);
  23.         System.out.println("\n Luas Permukaannya : " + luasP);
  24.  
  25.         volume = 1/(float)3 * phi * r * r * tinggi;
  26.         System.out.println(" Volume Kerucutnya  : " + volume);
  27.     }
  28. }
  29.  
Add Comment
Please, Sign In to add comment