Esempio n. 1
0
        static void Main(string[] args)
        {
            PrinterW printerw = new PrinterW();

            printerw.Print();
            printerw.Show();

            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();
        }
Esempio n. 2
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();
        }