Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Pilih Printer: \n1. Epson\n2. Canon\n3. LaserJet");

            Console.Write("\nNomor Printer [1..3] : ");
            int nomorPrinter = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine();

            IPrinterWindows printer = new PrinterWindows();

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

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

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Nama\t: Sangaji");
            Console.WriteLine("NIM\t: 19.11.2730");
            Console.WriteLine("Kelas\t: 19 IF 03");

            Console.WriteLine();

            Console.WriteLine("Pilih Printer: \n1. Epson\n2. Canon\n3. LaserJet");

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

            Console.WriteLine();

            IPrinterWindows printer = new PrinterWindows();

            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 valid \n");
            }

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

            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Nama : Khias Nurlatif Ari Subekti");
            Console.WriteLine("NIM  : 19.11.2776");
            Console.WriteLine("Kelas: IF 03\n");

            IPrinterWindows printer = new PrinterWindows();

printerNumberInput:
            Console.WriteLine("Choose a Printer: ");
            Console.WriteLine("1. Epson");
            Console.WriteLine("2. Canon");
            Console.WriteLine("3. LaserJet");

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

            if (printerNumber == 1)
            {
                printer = new Epson();
            }
            else if (printerNumber == 2)
            {
                printer = new Canon();
            }
            else if (printerNumber == 3)
            {
                printer = new LaserJet();
            }
            else
            {
                Console.WriteLine("Sorry. The number you input has not been recorded. Please try again.\n");
                goto printerNumberInput;
            }

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

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Rafif Fauzan Almahdy | 19.11.2750 \n");


            IPrinterWindows printer = new PrinterWindows();

            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();
            }
            if (nomorPrinter == 2)
            {
                printer = new Canon();
            }
            else if (nomorPrinter == 3)
            {
                printer = new LaserJet();
            }
            else
            {
                Console.WriteLine("Error : Pilihan Tidak Ada");
            }

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

            Console.ReadKey();
        }