static void Main(string[] args) { ILaptop laptop; laptop = new Lenovo(); laptop.menyala(); Console.WriteLine(); laptop = new Asus(); laptop.menyala(); Console.ReadKey(); }
public static void Menu1() { Dell dell = new Dell(500); Asus asus = new Asus(700); char done = 'n'; Console.WriteLine("Please choose a single or multple item"); do { Console.WriteLine("a. Dell: 500$ "); Console.WriteLine("b. Asus: 700$"); char order = char.Parse(Console.ReadLine()); switch (order) { case 'a': Count += dell.Price(); using (StreamWriter w = File.AppendText("bill.txt")) { w.WriteLine("Dell: 500$"); } break; case 'b': Count += asus.Price(); using (StreamWriter w = File.AppendText("bill.txt")) { w.WriteLine("Asus: 700$"); } break; default: Console.WriteLine("Not on the menu!"); break; } Console.Write("Order Complete?(y/n)"); done = Char.Parse(Console.ReadLine()); Console.Clear(); cashRegister += Count; }while (done == 'n' || done == 'N'); Console.WriteLine("Please take your bill"); using (StreamWriter w = File.AppendText("bill.txt")) { w.WriteLine("Total Bill: {0}", Count); } }
static void Main(string[] args) { int pilih; do { Console.WriteLine("\n======== Toko Laptop & Komputer Awan ========\n"); Console.WriteLine("Barang apa yang ingin anda beli : "); Console.WriteLine("1. Laptop "); Console.WriteLine("2. Komputer "); Console.WriteLine("3. Keluar "); Console.WriteLine("Masukan Pilihan Anda [1/2] = "); pilih = Convert.ToInt32(Console.ReadLine()); if (pilih == 1) { Console.WriteLine("\n======== Laptop Toko Awan ========\n"); Console.WriteLine("Laptop apa yang ingin ingin anda beli : "); Console.WriteLine("1. Acer "); Console.WriteLine("2. Asus"); Console.WriteLine("3. Lenovo \n"); Console.WriteLine("Masukan Pilihan Anda [1-3] = "); int pilihlaptop = Convert.ToInt32(Console.ReadLine()); if (pilihlaptop == 1) { // Laptop Acer Acer myAcer = new Acer(); myAcer.BeliLaptop(); myAcer.beliL(); } else if (pilihlaptop == 2) { // Laptop Asus Asus myAsus = new Asus(); myAsus.BeliLaptop(); myAsus.beliL(); } else if (pilihlaptop == 3) { // Laptop Lenovo Lenovo myLenovo = new Lenovo(); myLenovo.BeliLaptop(); myLenovo.beliL(); } else { Console.WriteLine("Maaf Pilihan Tidak Tersedia"); } } else if (pilih == 2) { Console.WriteLine("\n======== Komputer Toko Awan ========\n"); Console.WriteLine("Komputer apa yang ingin ingin anda beli : "); Console.WriteLine("1. Komputer Biasa "); Console.WriteLine("2. Komputer Gaming"); Console.WriteLine("3. Komputer VideoEditing \n"); Console.WriteLine("Masukan Pilihan Anda [1-3] = "); int pilihkomputer = Convert.ToInt32(Console.ReadLine()); if (pilihkomputer == 1) { Biasa myBiasa = new Biasa(); myBiasa.BeliKomputer(); } else if (pilihkomputer == 2) { Gaming myGaming = new Gaming(); myGaming.BeliKomputer(); } else if (pilihkomputer == 3) { VideoEditing myVideoEditing = new VideoEditing(); myVideoEditing.BeliKomputer(); } else { Console.WriteLine("Maaf Pilihan Tidak Tersedia"); } } }while(pilih != 3); }