Untuk hasil run nya bisa di coba sendiri,, hehe
package latihan_kuis;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Latihan_kuis {
public static void main(String[] args) {
int jum= 0,inten=0;
//int anu= 0;
int [] hari=new int[10];
String [] nama=new String[30];
int [] gaji=new int[1000];
BufferedReader isi=new BufferedReader(new InputStreamReader(System.in) );
System.out.println("=====================================");
System.out.println("Sistem Penggajian Karyawan PT suka-suka ");
System.out.println("=====================================");
try
{
System.out.print("Masukkan Jumlah Karyawan = ");
jum = Integer.parseInt(isi.readLine());
for (int i = 1; i <= jum; i++)
{
System.out.println("Data karyawan ke -"+i);
System.out.print("Masukkan Nama = ");
nama[i] = isi.readLine();
System.out.print("Masukkan jumlah hari "+i+" = ");
hari[i] = Integer.parseInt(isi.readLine());
}
}
catch (NumberFormatException e)
{
System.out.println("Inputan harus angka !");
}
catch (Exception e)
{
System.out.println(" Erroor !");
}
System.out.println("=====================================");
System.out.println("Sistem Penggajian Karyawan PT suka-suka ");
System.out.println("=====================================");
System.out.println("No. Nama \t Gaji");
int anu = 0;
for (int i = 1; i <= jum; i++)
{
if (hari[i] < 28)
{
inten=0;
}
if (hari[i] >= 28)
{
inten=300000;
}
gaji[i]=(hari[i]*50000+hari[i]*15000)+inten; //gaji
anu=anu+gaji[i]; //menampilkan total
System.out.println(i+". "+nama[i]+" \t "+gaji[i]);
}
System.out.println("=====================================");
System.out.println("Total yang harus dikeluarkan perusahaan = "+anu);
}
}
sumber : latihan kuis pemrograman - 2