Hasbi_Assidiqqi

4. Buatl Fungsi Void yang didalamnya terdapat fungsi return

Mar 22nd, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner inputUser = new Scanner(System.in);
  7.         double bb, tb;
  8.  
  9.         System.out.print("Masukkan Berat Badan = ");
  10.         bb = inputUser.nextDouble();
  11.         System.out.print("Masukkan Tinggi Badan = ");
  12.         tb = inputUser.nextDouble();
  13.  
  14.         print(bb,tb);
  15.  
  16.  
  17.     }
  18.     private static int beratideal(double bb, double tb) {
  19.         return (int) ((bb - 100) - (10/100 * (tb - 100)));
  20.     }
  21.  
  22.     private static void print(double bb, double tb) {
  23.         System.out.println("Berat badan ideal anda adalah = " + beratideal(bb,tb));
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment