Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
karyawan
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; //Auth : Praditya Lutvi Charisma class Rextester{ public static void main(String args[]){ Karyawan karyawan1 = new Karyawan(1, "Anto", 8000000, "Asia", 1); Karyawan karyawan2 = new Karyawan(2, "Andi", 5000000, "Europe", 2); Karyawan karyawan3 = new Karyawan(3, "Budi", 11000000, "Asia", 1); Karyawan karyawan4 = new Karyawan(4, "Nita", 10000000, "North America", 3); Karyawan karyawan5 = new Karyawan(5, "Bagus", 2000000, "Europe", 2); List<Karyawan> listKaryawan = new ArrayList<>(); listKaryawan.add(karyawan1); listKaryawan.add(karyawan2); listKaryawan.add(karyawan3); listKaryawan.add(karyawan4); listKaryawan.add(karyawan5); for(int i=0; i<listKaryawan.size(); i++){ System.out.println("ID : " +listKaryawan.get(i).getId()+ "\tNama : "+listKaryawan.get(i).getNama()+"\tGaji Akhir: "+listKaryawan.get(i).getGajiAkhir()); } } } class Karyawan { int id, gaji, level; String nama, region; public Karyawan(int id, String nama, int gaji, String region, int level) { this.id = id; this.gaji = gaji; this.level = level; this.nama = nama; this.region = region; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getGaji() { return gaji; } public void setGaji(int gaji) { this.gaji = gaji; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } public int getGajiAkhir(){ int gajiAkhir = 0; if(gaji >= 7000000){ gajiAkhir = (int) ((1.1)*gaji); } else if (gaji > 4000000 && gaji< 7000000){ gajiAkhir = (int) ((1.2)*gaji); } else if(gaji < 4000000){ gajiAkhir = (int) ((1.4)*gaji); } switch(level){ case 1: gajiAkhir += 200000; break; case 2: gajiAkhir += 500000; break; case 3: gajiAkhir += 1000000; break; default: break; } if(region == "Asia"){ gajiAkhir = (int) (0.98 * gajiAkhir); }else if(region == "Europe"){ gajiAkhir = (int) (0.975 * gajiAkhir); }else if(region == "North America"){ gajiAkhir = (int) (0.97 * gajiAkhir); } return gajiAkhir; } }
run
|
edit
|
history
|
help
0
different ways to add parenthesis leetcode #241
Find a dot in a string
ex25
amit
Increment Operator
JAVA # DİZİ İLE EN BÜYÜK BULMA
Java messing around
Sum of EVEN and ODD nubmers (11 grade)
Sample ArrayList
Path finding given 2D array