PROGRAM PERPUSTAKAAN MAHASISWA
*Kodingan *
package perpustakaanmahasiswa;
import java.util.Scanner;
/**
*
* @author Lenovo
*/
public class Perpustakaanmahasiswa {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("masukan datanya " );
System.out.println("***************************");
System.out.print("Nama : ");
String Nama = input.nextLine();
System.out.print("NIM : ");
String NIM = input.nextLine();
System.out.print("Masukan jumlah buku : ");
int jumlah = input.nextInt();
System.out.println();
int total = 0;
int i = 0;
String[] judul = new String[jumlah];
int [] jenis = new int [jumlah];
int [] harga = new int [jumlah];
do{
Scanner inputarr = new Scanner(System.in);
System.out.print("judul buku ke-"+ i +" : ");
judul[i] = inputarr.nextLine();
System.out.print("jenis buku <1>:buku komputer<2>buku non komputer | pilih : ");
jenis[i] = inputarr.nextInt();
if(jenis[i]==1){
harga[i]=5000;}
else if (jenis[i]==2){
harga[i]=3000;}i++;
}while(i<jumlah);
System.out.println();
System.out.println("***************************");
System.out.println("Nama : "+Nama);
System.out.println("NIM :" + NIM );
System.out.println("Nama anda : " + Nama );
System.out.println("***************************");
System.out.println(" buku yang di pinjam" );
System.out.println("***************************" );
i=0;
do{
System.out.println(i+"|"+judul[i]+"Harga sewa : "+harga[i]);
total=total+harga[i];
i++;
}
while(i<jumlah);
System.out.println("***************************" );
System.out.println("total biaya pinjam "+total );
}
}
import java.util.Scanner;
/**
*
* @author Lenovo
*/
public class Perpustakaanmahasiswa {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("masukan datanya " );
System.out.println("***************************");
System.out.print("Nama : ");
String Nama = input.nextLine();
System.out.print("NIM : ");
String NIM = input.nextLine();
System.out.print("Masukan jumlah buku : ");
int jumlah = input.nextInt();
System.out.println();
int total = 0;
int i = 0;
String[] judul = new String[jumlah];
int [] jenis = new int [jumlah];
int [] harga = new int [jumlah];
do{
Scanner inputarr = new Scanner(System.in);
System.out.print("judul buku ke-"+ i +" : ");
judul[i] = inputarr.nextLine();
System.out.print("jenis buku <1>:buku komputer<2>buku non komputer | pilih : ");
jenis[i] = inputarr.nextInt();
if(jenis[i]==1){
harga[i]=5000;}
else if (jenis[i]==2){
harga[i]=3000;}i++;
}while(i<jumlah);
System.out.println();
System.out.println("***************************");
System.out.println("Nama : "+Nama);
System.out.println("NIM :" + NIM );
System.out.println("Nama anda : " + Nama );
System.out.println("***************************");
System.out.println(" buku yang di pinjam" );
System.out.println("***************************" );
i=0;
do{
System.out.println(i+"|"+judul[i]+"Harga sewa : "+harga[i]);
total=total+harga[i];
i++;
}
while(i<jumlah);
System.out.println("***************************" );
System.out.println("total biaya pinjam "+total );
}
}
~ Hasil Run ~
PROGRAM KARYAWAN
* Kodingan *
package karyawan;
import java.util.Calendar;
import java.util.Scanner;
/**
*
* @author Lenovo
*/
public class Karyawan {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
System.out.print("Masukan nama : ");
String nama = input.nextLine();
System.out.print("Masukan NIK : ");
String NIK = input.nextLine();
System.out.print("Masukan tahun lahir : ");
int umur = input.nextInt();
System.out.print("Masukan masa kerja(tahun) : ");
short lama_kerja = input.nextByte();
int hasil = year-umur;
System.out.println("********************************* ");
System.out.println("Nama anda : " + nama );
System.out.println("NIK anda : " + NIK );
System.out.println("umur anda : " + hasil +"tahun" );
System.out.println("Masa kerja anda: " + lama_kerja + "tahun" );
if (lama_kerja <5)
System.out.println("Gaji anda : Rp.3.000.000 " );
else if(lama_kerja>4)
System.out.println("Gaji anda :Rp.6.000.000 " );
}
}
import java.util.Calendar;
import java.util.Scanner;
/**
*
* @author Lenovo
*/
public class Karyawan {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
System.out.print("Masukan nama : ");
String nama = input.nextLine();
System.out.print("Masukan NIK : ");
String NIK = input.nextLine();
System.out.print("Masukan tahun lahir : ");
int umur = input.nextInt();
System.out.print("Masukan masa kerja(tahun) : ");
short lama_kerja = input.nextByte();
int hasil = year-umur;
System.out.println("********************************* ");
System.out.println("Nama anda : " + nama );
System.out.println("NIK anda : " + NIK );
System.out.println("umur anda : " + hasil +"tahun" );
System.out.println("Masa kerja anda: " + lama_kerja + "tahun" );
if (lama_kerja <5)
System.out.println("Gaji anda : Rp.3.000.000 " );
else if(lama_kerja>4)
System.out.println("Gaji anda :Rp.6.000.000 " );
}
}
~ Hasil Run ~
Tidak ada komentar:
Posting Komentar