Example #1
0
        public static void Main(string[] args)
        {
            PrinterWindows printer = new PrinterWindows();



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

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

            if (pilihPrinter > 0 && pilihPrinter < 4)
            {
                if (pilihPrinter == 1)
                {
                    printer = new Epson();
                }
                else if (pilihPrinter == 2)
                {
                    printer = new Canon();
                }
                else
                {
                    printer = new LaserJet();
                }
            }
            else
            {
                Console.WriteLine("Pilihan tidak tersedia \n");
            }



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

            Console.ReadKey();
        }