Esempio n. 1
0
 public static void tampilkanPaket(MobilTersedia[] listMobil, Paket[] listPaket)
 {
     Console.WriteLine("====================================");
     //Paket[] listPaket = new Paket[3];
     listPaket[0] = new Paket("Per jam", 200000);
     listPaket[1] = new Paket("Per hari", 190000);
     listPaket[2] = new Paket("Per minggu", 180000);
     Console.WriteLine("No\tJenis Paket\tTarif");
     for (int i = 0; i < listPaket.Length; i++)
     {
         Console.WriteLine("{0}\t{1}\t{2}", i + 1, listPaket[i].nama, listPaket[i].tarif);
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Selamat Datang!");
            Console.WriteLine("====================================");
            Customer customer1 = new Customer();

            Console.Write("Nama: ");
            customer1.Nama = Console.ReadLine();
            Mobil mobil1 = new Mobil();

            Console.Write("Masukkan jumlah kursi mobil yang diinginkan: ");
            mobil1.SeatCount = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("====================================");
            MobilTersedia[] listMobil = new MobilTersedia[5];
            SetStock.readStock(listMobil);
            CariMobil.cariMobil(listMobil, mobil1.SeatCount);
            Paket[] listPaket = new Paket[3];
            TampilPaket.tampilkanPaket(listMobil, listPaket);
            Console.WriteLine("====================================");
            Console.Write("Masukkan pilihan mobil: ");
            int i = Convert.ToInt32(Console.ReadLine());

            Console.Write("Masukkan pilihan paket: ");
            int j = Convert.ToInt32(Console.ReadLine());

            Console.Write("Masukkan jumlah mobil : ");
            int        jlh  = Convert.ToInt32(Console.ReadLine());
            DetailSewa sewa = new DetailSewa();

            sewa.Nama   = listMobil[i - 1].nama;
            sewa.Paket  = listPaket[j - 1].nama;
            sewa.Tarif  = listPaket[j - 1].tarif;
            sewa.Jumlah = jlh;
            int total = sewa.tampilkan();

            Console.Write("Buat pesanan? [ya/tidak]: ");
            string konf = Console.ReadLine();

            if (konf == "ya")
            {
                Pembayaran.bayar(total);
            }
            listMobil[i - 1].stock = (listMobil[i - 1].stock) - jlh;
            SetStock.writeStock(listMobil);
            sewa.setLog(customer1.Nama);
        }