Advertisement
JacKka

Untitled

Apr 9th, 2020
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package perulangan;
  7.  
  8. /**
  9.  *
  10.  * @author ivan
  11.  */
  12. public class Perulangan {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.         // TODO code application logic here
  19.         EnergiPotensial[] kerikil;
  20.         kerikil = new EnergiPotensial[10];
  21.        
  22.         for(int i=0;i<10;i++){
  23.             kerikil[i] = new EnergiPotensial();
  24.             kerikil[i].setUkuran(5*i+10, 10, 2);    
  25.         }
  26.         for(EnergiPotensial item:kerikil){
  27.             if(item.hitungEP()>500){
  28.                 System.out.println(item.hitungEP()+ "Kerikil besar");
  29.             }
  30.             else{
  31.                 System.out.println(item.hitungEP()+ "Kerikil kecil");
  32.             }
  33.         }
  34.     }
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement