ariestamirra

kabKota

Apr 27th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package No4;
  2.  
  3. public class KabKota {
  4.     private String namaKabKota;
  5.     private float jmlPenduduk;
  6.    
  7.     public void setNamaKabKota(String k){
  8.         namaKabKota=k;
  9.     }
  10.     public void setJmlPenduduk(float p){
  11.         jmlPenduduk=p;
  12.     }
  13.     public String getNamaKabKota(){
  14.         return namaKabKota;
  15.     }
  16.     public float getJmlPenduduk(){
  17.         return jmlPenduduk;
  18.     }
  19.     public void drawHistogram(){
  20.        
  21.         int n=Math.round(jmlPenduduk);
  22.         for (int i = 0; i < n; i++) {
  23.             System.out.print("*");
  24.         }
  25.     }
  26.    
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment