Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Monitor lgMonitor = new Monitor("1200x600", true, 32);
            Printer hpPrinter = new Printer("HP", "MP102", 50);

            Vga       nvdiaVga       = new Vga("Nvidia", 2054, 2054);
            Ram       samsungRam     = new Ram("DDR4", 5000, 8000);
            Processor intelProcessor = new Processor();

            intelProcessor.setCache(254);
            intelProcessor.setCore(8);
            intelProcessor.setSeries("CORE i7 8th Gen");

            Computer computer = new Computer.Builder(samsungRam, nvdiaVga, intelProcessor) //parameter wajib
                                .withMonitor(lgMonitor)                                    //parameter opsional
                                .withPrinter(hpPrinter)                                    //parameter opsional
                                .build();

            Console.WriteLine(computer.ToString());
        }
Ejemplo n.º 2
0
 public Builder(Ram ram, Vga vga, Processor processor)
 {
     this.ram       = ram;
     this.vga       = vga;
     this.processor = processor;
 }