Пример #1
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("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();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Printer printer;

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

            Console.Write("Pilih Berdasarkan Nomer Printer : ");
            int NoPrinter = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\n");

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

            printer.show();
            printer.print();

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            PrinterWindows Printer;

            Console.WriteLine("\t=================");
            Console.WriteLine("\t| Jenis Printer |");
            Console.WriteLine("\t=================");
            Console.WriteLine("\t| 1. Canon      |");
            Console.WriteLine("\t| 2. Epson      |");
            Console.WriteLine("\t| 3. Laser Jet  |");
            Console.WriteLine("\t=================\n");
            Console.Write("\tPilihan Printer (1-3) : ");
            int pilihPrinter = Convert.ToInt32(Console.ReadLine());

            if (pilihPrinter == 1)
            {
                Printer = new Canon();
            }
            else if (pilihPrinter == 2)
            {
                Printer = new Epson();
            }
            else
            {
                Printer = new LaserJet();
            }

            Printer.Show();
            Printer.Print();

            Console.ReadKey();
        }
Пример #4
0
        static void Main(string[] args)
        {
            PrinterWindows printer;

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

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

            switch (nomorPrinter)
            {
            case 1:
                printer = new Epson();
                printer.Show();
                printer.Print();
                break;

            case 2:
                printer = new Canon();
                printer.Show();
                printer.Print();
                break;

            case 3:
                printer = new LaserJet();
                printer.Show();
                printer.Print();
                break;

            default:
                Console.WriteLine("Nomor yang anda masukan tidak ada, Coba lagi");
                break;
            }


            Console.ReadKey();
        }