Exemplo n.º 1
0
        public void ChooseSpecs()
        {
            displayBox.Items.Clear();

            int processorChoice    = rGen.Next(Constants.PROCESSOR_COUNT);
            int graphicsCardChoice = rGen.Next(Constants.GRAPHICSCARD_COUNT);
            int ramChoice          = rGen.Next(Constants.RAM_COUNT);
            int monitorChoice      = rGen.Next(Constants.MONITOR_COUNT);
            int totalPrice         = 0;

            Processor    currentProcessor    = computerFactory.createProcessor(processorChoice);
            GraphicsCard currentGraphicsCard = computerFactory.createGraphicsCard(graphicsCardChoice);
            Ram          currentRam          = computerFactory.createRam(ramChoice);
            Monitor      currentMonitor      = computerFactory.createMonitor(monitorChoice);

            totalPrice += currentProcessor.Price;
            totalPrice += currentGraphicsCard.Price;
            totalPrice += currentRam.Price;
            totalPrice += currentMonitor.Price;

            displayBox.Items.Add("Price    Component");
            displayBox.Items.Add("- - - - - - - - - - - - - - - - - -");
            displayBox.Items.Add(currentProcessor.ToString());
            displayBox.Items.Add(currentGraphicsCard.ToString());
            displayBox.Items.Add(currentRam.ToString());
            displayBox.Items.Add(currentMonitor.ToString());
            displayBox.Items.Add("- - - - - - - - - - - - - - - - - -");
            displayBox.Items.Add("Total Price: " + totalPrice);
        }
Exemplo n.º 2
0
        public void printSpec()
        {
            CPU     currCPU     = componentFactory.makeCPU();
            GPU     currGPU     = componentFactory.makeGPU();
            RAM     currRAM     = componentFactory.makeRam();
            Monitor currMonitor = componentFactory.makeMonitor();

            double totalPrice = currCPU.Price + currGPU.Price + currRAM.Price + currMonitor.Price;

            displayBox.Items.Clear();
            displayBox.Items.Add("Price\tComponent");
            displayBox.Items.Add("----------------------------------");

            displayBox.Items.Add(currCPU.ToString());
            displayBox.Items.Add(currGPU.ToString());
            displayBox.Items.Add(currRAM.ToString());
            displayBox.Items.Add(currMonitor.ToString());

            displayBox.Items.Add("----------------------------------");
            displayBox.Items.Add("Total Price: $" + totalPrice.ToString());
        }