ETS PBO B Manless parking system
kali ini saya mengerjakan ETS PBO kelas B mensimulasikan mesin parkir sederhana
saya menggunakan kelas bill & kelas system parkir
source code bill
source code system parkir
Screen shot hasil
Contoh tiket
saya menggunakan kelas bill & kelas system parkir
source code bill
/**
* Write a description of class system_parkir here.
*
* @author (Vinsensius Yuda P.)
* @version (UTS PBO B 15/10/2018)
*/
/**
* bill
*/
import java.util.Scanner;
public class bill
{ public void print(String nopol, int kendaraan){
System.out.println("bill");
System.out.println("plat nomer : " + nopol);
if (kendaraan == 1)
{
System.out.println("motor fee parkir : 2000");
}
else
{
System.out.println("mobil fee parkir : 5000");
}
}}
source code system parkir
/**
* Write a description of class system_parkir here.
*
* @author (Vinsensius Yuda P.)
* @version (UTS PBO B 15/10/2018)
*/
/**
* sistem parkir
*/
import java.util.Scanner;
public class system_parkir
{
public static void main (String[] args){
int bayar;
int hrg1 = 2000;
int hrg2 = 5000;
int kendaraan;
String nopol;
bill karcisbayar = new bill();
Scanner inp = new Scanner(System.in);
System.out.println("***************************");
System.out.println("Selamat Datang di Manless parking");
System.out.println("Parkir Sekali Bayar!!!");
System.out.println("input nopol :" );
nopol = inp.nextLine();
System.out.println("pilih jenis kendaraan :");
System.out.println("1.Motor @2000");
System.out.println("2.Mobil @5000");
kendaraan = inp.nextInt();
System.out.println("Ambil karcis");
System.out.println("*************");
System.out.println("Karcis parkir");
System.out.println("Plat Nomor" +nopol);
System.out.println("*************");
if (kendaraan == 1)
{System.out.println("Tarif parkir untuk motor");
System.out.println("Biaya :"+ hrg1);
System.out.println("Bayar :");
bayar = inp.nextInt();
while (bayar < hrg1)
{
System.out.println("Maaf pembayaran kurang " + (hrg1 - bayar));
bayar += inp.nextInt();
}
karcisbayar.print(nopol,kendaraan);
System.out.println("Silahkan Keluar");
}
if (kendaraan == 2)
{System.out.println("Tarif parkir untuk mobil");
System.out.println("Biaya :"+ hrg2);
bayar = inp.nextInt();
while (bayar < hrg1)
{
System.out.println("Maaf pembayaran kurang " + (hrg2 - bayar));
bayar += inp.nextInt();
}
karcisbayar.print(nopol,kendaraan);
System.out.println("Silahkan Keluar");
}
}}
Screen shot hasil
Contoh tiket
Komentar
Posting Komentar