Minggu, 14 Oktober 2018

e-parkir

Nama : Hafidz Firman Asqalany
NRP   : 05111740000195
Kelas  : PBO A


Source code:

 /**  
  * Write a description of class Main here.  
  * program e-parkir  
  * @author (Hafidz Firman Asqalany)  
  * @version (15102018)  
  */  
 import java.util.Scanner;  
 public class Main  
 {  
   private static int b_parkir;  
   public static void main(String args[]){  
     Scanner input=new Scanner(System.in);  
     int jam_parkir,kendaraan=0;  
     String nopol;  
     int sepeda=1000;  
     int motor=2000;  
     int mobil=3000;  
     System.out.println("Welcome to e-parkir");  
     System.out.println("Silahkan masukkan jenis kendaraan anda");  
     System.out.println("1. Motor");  
     System.out.println("2. Mobil");  
     System.out.println("3. sepeda");  
     kendaraan=input.nextInt();  
     if(kendaraan==1){  
       System.out.println("Silahkan masukkan nomor plat anda");  
       nopol=input.next();  
       System.out.println("Tentukan Durasi Parkir");  
       jam_parkir=input.nextInt();  
       if(jam_parkir==1){  
         b_parkir=motor;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       else if(jam_parkir>=2){  
         b_parkir=jam_parkir*motor;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       System.out.println("===============");  
       System.out.println("e-parkir");  
       System.out.println("##ini karcis anda##");  
       System.out.println("nopol anda:"+nopol);  
       System.out.println("total biaya " +b_parkir);  
       System.out.println("===============");  
     }  
     if(kendaraan==2){  
       System.out.println("Silahkan masukkan nomor plat anda");  
       nopol=input.next();  
       System.out.println("Tentukan Durasi Parkir");  
       jam_parkir=input.nextInt();  
       if(jam_parkir==1){  
         b_parkir=mobil;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       else if(jam_parkir>=2){  
         b_parkir=jam_parkir*mobil;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       System.out.println("===============");  
       System.out.println("e-parkir");  
       System.out.println("##ini karcis anda##");  
       System.out.println("nopol anda: "+nopol);  
       System.out.println("total biaya " +b_parkir);  
       System.out.println("===============");  
     }  
     if(kendaraan==3){  
       System.out.println("Tentukan Durasi Parkir");  
       jam_parkir=input.nextInt();  
       if(jam_parkir==1){  
         b_parkir=sepeda;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       else if(jam_parkir>=2){  
         b_parkir=jam_parkir*sepeda;  
         System.out.println("anda harus membayar " +b_parkir);  
         System.out.println("tempelkan kartu pembayaran anda");  
       }  
       System.out.println("===============");  
       System.out.println("e-parkir");  
       System.out.println("##ini karcis anda##");  
       System.out.println("total biaya " +b_parkir);  
       System.out.println("===============");  
     }  
   }  
 }  

hasilnya :

Tidak ada komentar:

Posting Komentar