Пример #1
0
        static void Main(string[] args)
        {
            IPrinterWindows Printer;

            Console.WriteLine("Pilih Salah Satu Printer : ");
            Console.WriteLine("1. E p s o n");
            Console.WriteLine("2. C a n o n");
            Console.WriteLine("3. L a s e r J e t \n");

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

            if (NOPrinter == 1)
            {
                Printer = new Epson();
            }
            else if (NOPrinter == 2)
            {
                Printer = new Canon();
            }
            else if (NOPrinter == 3)
            {
                Printer = new LaserJet();
            }
            else
            {
                Console.WriteLine("\nAnda Salah input\n");
                return;
            }


            Printer.Show();
            Printer.Print();
        }
Пример #2
0
        static void Main(string[] args)
        {
            IPrinterWindows printer;

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

            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();
        }
    static void Main(string[] args)
    {
      IPrinterWindows printer;

      Console.WriteLine("Pilih Printer");
      Console.WriteLine("1. Epson");
      Console.WriteLine("2. Canon");
      Console.WriteLine("3. Laser Jet");

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

      if (nomorprinter == 1)
          printer = new Canon();
      else if (nomorprinter == 2)
          printer = new Epson();
      else
          printer = new IPrinterWindows();

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


      Console.ReadKey();
    }