NRP : 05111740000054
kelas : PBO - B
- System Parkir Manless -
- Class
- Class tiket
/**
* Yasinta Yusniawati
* PBO - B
* ETS
*
*/
import java.util.Scanner;
public class tiket
{
private input in;
private kendaraan ken;
private int cost = 0;
public tiket()
{
in = new input();
ken = new kendaraan();
}
public void jalankan()
{
print_ucapan();
ken.createKendaraan();
System.out.println("I N F O R M A S I P A R K I R");
System.out.println("Tipe kendarran : " + ken.type);
System.out.println("PLAT : " + ken.nomor);
System.out.println("Waktu : " + ken.waktu + "jam");
cost = (1000 * ken.type * ken.waktu);
System.out.println("Tarif Parkir : Rp. " + cost);
System.out.println("Tekan sembarang untuk cetak");
in.getinput();
cetak_tiket();
}
private void print_ucapan()
{
System.out.println("SISTEM TIKET ELEKTRONIK RS.SARJITO YOGJAKARTA");
}
public void cetak_tiket()
{
System.out.println("\n=========TIKET PARKIR ========");
System.out.println(" RS. SARJOITO YOGJAKARTA");
System.out.println("Type kendaraan : " + ken.type);
System.out.println("PLAT : " + ken.nomor);
System.out.println("Waktu : " + ken.waktu + "Jam");
System.out.println("Tarif : " + cost);
}
}
- Class kendaraan
/**
* Yasinta Yusniawati
* PBO - B
* ETS)
*/
public class kendaraan
{
private input in;
public int type = 0;
public int waktu = 0;
public String nomor;
public void createKendaraan()
{
in = new input();
type = Type();
nomor = Nomor();
waktu = Waktu();
}
public int Type()
{
System.out.println("Pilih kendaraan :");
System.out.println("1. Mobil");
System.out.println("2. Motor");
System.out.println("3. Bis kecil");
type = in.getint();
return type;
}
public int Waktu()
{
System.out.println("Perkiraan waktu parkir: ");
waktu = in.getint();
return waktu;
}
public String Nomor()
{
System.out.println("Masukkan nomor plat : ");
String nomor = in.getinput();
return nomor;
}
}
- Class input
/**
* Yasinta Yusniawati
* PBO - B
* ETS
*/
import java.util.Scanner;
public class input
{
public String getinput()
{
Scanner sc = new Scanner(System.in);
String inp = sc.nextLine();
return inp;
}
public int getint()
{
Scanner sc = new Scanner(System.in);
int inp = sc.nextInt();
return inp;
}
}
- Hasil
Tidak ada komentar:
Posting Komentar