static void Main(string[] args) { printer newInterfacePrinter = null; Console.WriteLine("Pilih Printer :\n"); Console.WriteLine("1.Epson"); Console.WriteLine("2.Canon"); Console.WriteLine("3.LaserJet\n"); Console.WriteLine("Pilih Nomor Printer = "); int Pilihan = Convert.ToInt32(Console.ReadLine()); if (Pilihan == 1) { newInterfacePrinter = new Epson(); } else if (Pilihan == 2) { newInterfacePrinter = new Canon(); } else if (Pilihan == 3) { newInterfacePrinter = new LaserJet(); } else { Console.WriteLine("Maaf, Opsi Tersebut Belum Tersedia :( Pakai Default Aja Ya :("); } newInterfacePrinter.Show(); newInterfacePrinter.Print(); Console.ReadKey(); }
static void Main(string[] args) { Iprinter newInterfacePrinter = null; Console.WriteLine("Pilihlah Printer :\n"); Console.WriteLine("1.Epson"); Console.WriteLine("2.Canon"); Console.WriteLine("3.LaserJet\n"); Console.WriteLine("Pilih Nomor Printer = "); int Pilihan = Convert.ToInt32(Console.ReadLine()); if (Pilihan == 1) { newInterfacePrinter = new Epson(); } else if (Pilihan == 2) { newInterfacePrinter = new Canon(); } else if (Pilihan == 3) { newInterfacePrinter = new LaserJet(); } else { Console.WriteLine("\nMaaf opsi yang ada pilih salah"); } newInterfacePrinter.Show(); newInterfacePrinter.Print(); Console.ReadKey(); }
static void Main(string[] args) { PrinterWindows printer; Console.WriteLine("Pilih Printer :"); Console.WriteLine("1.Epson"); Console.WriteLine("2.Canon"); Console.WriteLine("3.LaserJet\n"); Console.Write("Nomor Printer [1...3] : "); int nomorPrinter = Convert.ToInt32(Console.ReadLine()); if (nomorPrinter == 1) { printer = new Epson(); } else if (nomorPrinter == 2) { printer = new Canon(); } else { printer = new LaserJet(); } printer.Show(); printer.Print(); Console.ReadKey(); }