Esempio n. 1
0
 public override string ToString()
 {
     return($"PC Info:\n\t>>> Processor: {Processor} - {ProcessorInGHz} GHz - {ProcessorCount} cores.\n\t" +
            $">>> RAM: {RAMType.ToString()} {RAMSizeInGb} Gb.\n\t" +
            $">>> Graphics card: {GraphicsCard.ToString()} {GraphicsCardMemoryInMb} Mb.\n\t" +
            $">>> Hard Disk: {HardDiskType.ToString()} {HardDiskSizeInGb} Gb.\n\t" +
            $">>> OS: {OperatingSystemType.ToString()} {OperatingSystemVersion}.");
 }
        public void printSpec()
        {
            CPU          currentCPU          = computerMaker.makeCPU();
            RAM          currentRAM          = computerMaker.makeRAM();
            GraphicsCard currentGraphicsCard = computerMaker.makeGraphicsCard();
            Monitor      currentMonitor      = computerMaker.makeMonitor();

            double totalPrice = currentCPU.Price + currentRAM.Price + currentGraphicsCard.Price + currentMonitor.Price;

            listBox.Items.Clear();
            listBox.Items.Add("Part\tPrice\tComponent");
            listBox.Items.Add("------------------------------------------------------------------------------------");

            listBox.Items.Add("CPU:\t" + currentCPU.ToString());
            listBox.Items.Add("RAM:\t" + currentRAM.ToString());
            listBox.Items.Add("Graphics:\t" + currentGraphicsCard.ToString());
            listBox.Items.Add("Monitor:\t" + currentMonitor.ToString());

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