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

            Console.WriteLine("Pilih Printer:");
            Console.WriteLine(" 1. Epson\n 2. Canon\n 3. LaserJet\n\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 if (nomorPrinter == 3)
            {
                printer = new LaserJet();
            }
            else
            {
                Console.WriteLine("maaf, kode yang anda masukkan tidak terdaftar");
            }

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

            Console.WriteLine("Pilih Printer");
            Console.WriteLine("1. Epson");
            Console.WriteLine("2. Canon");
            Console.WriteLine("3. LaseJet\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();
            }

            Console.WriteLine();

            printer.Show();
            printer.print();

            Console.ReadKey();
        }