0% found this document useful (0 votes)
70 views5 pages

Pemrograman Berorientasi Objek: Disusun Oleh: Andi Irma Paduwai STB: 101448 Kelas: M

The document contains code for two Java programs. The first program allows the user to input employee data including name, ID number, salary grade, tenure, and calculates their gross and net salary. The second program allows a user to input guest information for a hotel including name, address, room type, and length of stay, and calculates the total bill and any discounts.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views5 pages

Pemrograman Berorientasi Objek: Disusun Oleh: Andi Irma Paduwai STB: 101448 Kelas: M

The document contains code for two Java programs. The first program allows the user to input employee data including name, ID number, salary grade, tenure, and calculates their gross and net salary. The second program allows a user to input guest information for a hotel including name, address, room type, and length of stay, and calculates the total bill and any discounts.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Tugas 2

Pemrograman Berorientasi Objek

Disusun Oleh : Andi Irma Paduwai STB : 101448 Kelas : M

import java.util.*; import java.io.*; class kuisdua { public static void main(string[] args) { scanner input=new scanner(system.in); int i,jumlah; String A= new String("A"); String B= new String("B"); String C= new String("C"); String D= new String("D"); String golongan[]= new String[15]; String nama[]=new String[15]; String nip[]=new String[15]; String gol[]=new String[15]; int lamaK[]=new int[15]; long gapok[]=new long[15]; long tunj[]=new long[15]; long tp[]=new long[15]; long gkotor[]=new long[15]; double pph[]=new double[15]; double gbersih[]=new double[15]; try{ system.out.print("Masukkan Jumlah Data yang ingin di Inputkan :"); jumlah=input.nextint(); for(i=1;i<=jumlah;i++){ System.out.println("\n Data ke-"+i+":"); System.out.print("Input NIP Anda :"); nip[i]=input.next(); System.out.print("Input Nama Anda :"); nama[i]=input.next(); System.out.println("Input Golongan [A/B/C/D] :"); gol[i]=input.next(); golongan[i] = gol[i].toUpperCase(); if (golongan[i].equals(A)) {gapok[i]=500000; tunj[i]=50000;} else if (golongan[i].equals(B)) {gapok[i]=1000000; tunj[i]=150000;} else if (golongan[i].equals(C)) {gapok[i]=1500000; tunj[i]=150000;} else if (golongan[i].equals(D)) {gapok[i]=2000000; tunj[i]=200000;} System.out.print("Input Lama Kerja :"); lamaK[i]=input.nextint(); if(lamaK[i]>= 15) tp[i]=50000000;

else tp[i]=0; gkotor[i]=gapok[i]+tunj[i]+tp[i]; pph[i]=0.1*gapok[i]; gbersih[i]=gkotor[i]-pph[i]; } for(i=1;i<=jumlah;i++){ System.out.println("DATA PEGAWAI"+i); system.out.println("================="); system.out.println("NIP"+nip[i]+"Dengan Nama :"+nama[i]); system.out.println("Dengan Golongan "+gol[i]); system.out.println("Gaji Pokok : "+gapok[i]); system.out.println("Tunjangan :"+tunj[i]); system.out.println("Dengan Lama Kerja :"+lamaK[i]+"Tahun"); system.out.println("Memperoleh Tunjangan Pensiun :"+tp[i]); system.out.println("Gaji Kotor :"+gkotor[i]); system.out.println("PPH :"+pph[i]); system.out.println("Gaji Bersih :"+gbersih[i]); } }catch(Exception e){ system.out.println("Eror"+e); } system.exit(0); } }

import java.io.DataInputStream; import java.io.IOException; class tugas22 { public static void main(String args[]) { DataInputStream baca = new DataInputStream(System.in); String nama = "",alamat = "", kalimat="" ; int hk = 0,tb = 0, li = 0; double dis = 0, jb = 0; char tk = (char)-1; try { System.out.print (" Input Nama anda : "); nama = baca.readLine(); System.out.print (" Input Alamat anda : "); alamat = baca.readLine(); System.out.print (" Input Lama Inap : "); kalimat = baca.readLine(); li = Integer.parseInt(kalimat); System.out.print("Input Tipe Kamar : "); kalimat = baca.readLine(); tk = kalimat.charAt(0); } catch(IOException e) { System.out.println(e); } switch(tk){ case '1' : hk = 300000; break; case '2' : hk = 500000; break; case '3' : hk = 750000; break; case '4' : hk = 1000000; break; case '5' : hk = 1250000; break; default:System.out.println("Anda Salah memasukkan golongan bro..!!"); break; } if (li > 3)

dis = 0.15 * hk; else dis = 0; tb = li * hk; jb = tb - dis; System.out.println("HOTELKU........"); System.out.println("---------------------------"); System.out.println("Saudara : "+nama +" dengan Alamat :" +alamat); System.out.println("Lama Inap :"+li +" Tipe Kamar :" +tk); System.out.println("Harga Kamar : "+hk); System.out.println("Total Bayar :"+tb); System.out.println("Diskon : "+dis); System.out.println("Jumlah Bayar :"+jb); } }

You might also like