Advertisement
satriafu5710

Luas & Volume Balok Java

Dec 8th, 2020
754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 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.        
  7.         Scanner userInput = new Scanner(System.in);
  8.  
  9.         float panjang, lebar, tinggi;
  10.         float luas, volume;
  11.  
  12.         System.out.println("\t Luas dan Volume Balok \n");
  13.  
  14.         System.out.print("\n Masukkan Panjang : ");
  15.         panjang = userInput.nextFloat();
  16.  
  17.         System.out.print(" Masukkan Lebar   : ");
  18.         lebar = userInput.nextFloat();
  19.  
  20.         System.out.print(" Masukkan Tinggi  : ");
  21.         tinggi = userInput.nextFloat();
  22.  
  23.         luas = 2 * (panjang * lebar + lebar * tinggi + panjang * tinggi);
  24.         System.out.println("\n Luas dari Balok   :" + luas);
  25.  
  26.         volume = panjang * lebar * tinggi;
  27.         System.out.println(" Volume dari Balok : " + volume);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement