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); }
public void printSpec() { Processor currCPU = machineMaker.makeCPU(); Memory currMemory = machineMaker.makeMemory(); GraphicsCard currGraphics = machineMaker.makeGraphicsCard(); MotherBoard currMotherBoard = machineMaker.makeMotherBoard(); double totalPrice = currCPU.Price + currMemory.Price + currGraphics.Price + currMotherBoard.Price; displayBox.Items.Clear(); displayBox.Items.Add("Price\tComponent"); displayBox.Items.Add("-----------------------------------------------------"); displayBox.Items.Add(currCPU.ToString()); displayBox.Items.Add(currMemory.ToString()); displayBox.Items.Add(currGraphics.ToString()); displayBox.Items.Add(currMotherBoard.ToString()); displayBox.Items.Add("-----------------------------------------------------"); displayBox.Items.Add("Total Price " + totalPrice.ToString()); }