static void Main(string[] args) { Console.WriteLine("==============MENU==============="); Console.WriteLine("Silahkan Pilih Nomor Printer"); Console.WriteLine("1.Epson"); Console.WriteLine("2.Canon"); Console.WriteLine("3.LaserJet"); Console.WriteLine("================================="); Console.WriteLine("Pilih Nomor Printer [1] [2] [3] :"); int nomorPrinter = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("================================="); Iinterface convert; if (nomorPrinter == 1) { convert = new Epson(); } else if (nomorPrinter == 2) { convert = new Canon(); } else { convert = new LaserJet(); } convert.Show(); convert.Print(); Console.ReadKey(); }
static void Main(string[] args) { IPrinterWindows 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(); }
static void Main(string[] args) { Printer printer = new Printer(); printer.show = "Printer status "; printer.print = "The printer is printing"; Console.WriteLine("Pilih Printer"); Console.WriteLine("1. Epson"); Console.WriteLine("2. Canon"); Console.WriteLine("3. LaserJet\n"); Console.Write("Nomor [1..3] : "); int nomorFormatData = Convert.ToInt32(Console.ReadLine()); IPrinters convert; if (nomorFormatData == 1) { convert = new Epson(); } else if (nomorFormatData == 2) { convert = new Canon(); } else { convert = new LaserJet(); } convert.Convert(printer); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Pilih Nomor Printer"); Console.WriteLine("1.Epson"); Console.WriteLine("2.Canon"); Console.WriteLine("3.LaserJet"); Console.WriteLine("Pilih Nomor Printer [1..3] : "); int nomorPrinter = Convert.ToInt32(Console.ReadLine()); IPrinterWindows convert; if (nomorPrinter == 1) { convert = new Epson(); } else if (nomorPrinter == 2) { convert = new Canon(); } else { convert = new LaserJet(); } convert.Show(); convert.Print(); Console.ReadKey(); }