static void Main(string[] args)
        {
            IPrinterWindows printer;

            Console.WriteLine("Pilih Printer : ");
            Console.WriteLine("1. Epson");
            Console.WriteLine("2. Canon");
            Console.WriteLine("3. Laser Jet\n");

            Console.Write("Nomor Printer [1...3] : ");
            int nomerPrinter = Convert.ToInt32(Console.ReadLine());

            if (nomerPrinter == 1)
            {
                printer = new Epson();
            }
            else if (nomerPrinter == 2)
            {
                printer = new Canon();
            }
            else if (nomerPrinter == 3)
            {
                printer = new LaserJet();
            }
            else
            {
                Console.WriteLine("\nInput Anda Salah\n");
                return;
            }

            printer.Show();
            printer.Print();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            PrinterWindows printer;

            Console.WriteLine("Pilih Printer : ");
            Console.WriteLine("1. Epson");
            Console.WriteLine("2. Canon");
            Console.WriteLine("3. LaserJet");

            Console.Write("Pilih Nomor Printer [1/2/3] : ");

            int NomorPrinter = Convert.ToInt32(Console.ReadLine());

            Console.Write("\n");

            if (NomorPrinter == 1)
            {
                printer = new Epson();
            }
            else if (NomorPrinter == 2)
            {
                printer = new Canon();
            }
            else
            {
                printer = new LaserJet();
            }

            printer.Show();
            printer.Print();

            Console.ReadKey();
        }