public Computer(string name, Component processor, Component graphicsCard, Component motherboard) { this.Name = name; computerProcessor = processor; computerGraphicsCard = graphicsCard; computerMotherboard = motherboard; }
public Computer(string name, string processorName, string graphicsCardName, string motherboardName, string processorDetails, string graphicsCardDetails, string motherboardDetails, decimal processorPrice, decimal graphicsCardPrice, decimal motherboardPrice, decimal price) { this.Name = name; this.processor = new Component(processorName, processorDetails, processorPrice); this.graphicsCard = new Component(graphicsCardName, graphicsCardDetails, graphicsCardPrice); this.motherboard = new Component(motherboardName, motherboardDetails, motherboardPrice); this.Price = price; }
static List<Component> AddComponents() { List<Component> components = new List<Component>(); string check = null; do { Console.WriteLine("Enter component: "); string name = Console.ReadLine(); Console.WriteLine("Enter details for the component: "); string details = Console.ReadLine(); Console.WriteLine("Enter component price:"); decimal price = decimal.Parse(Console.ReadLine()); Component component = new Component(name, price, details); components.Add(component); Console.WriteLine("Would you like to enter another component? Yes\\No"); check = Console.ReadLine(); } while (check != "No" && check != "no" && check != "NO"); return components; }
public Computer(string name, Component processor, decimal price) : this(name, processor, null, null) { this.Name = name; computerProcessor = processor; }
static void Main() { Component component = new Component(); component.VGA = "Radeon R280"; Console.WriteLine(component.VGA); }
/// <summary> /// Methods /// </summary> /// <param name="component"></param> /// <returns></returns> /// public bool AddComponent(Component component) { if (this.Components.Exists(x => x.Name == component.Name)) { return false; } this.Components.Add(component); return true; }
private void InizializeComponents(Component[] components) { foreach (var component in components) { this.components.Add(component); } }
public Computer(string name, decimal price, Component components) : this(name, price) { this.Components = components; }
/// <summary> /// adding or replace components to your PC /// </summary> /// <param name="componentType"></param> /// <param name="name"></param> /// <param name="price"></param> /// <param name="details"></param> public void AddOrReplaceComponent(ComponentsEnum componentType, string name, decimal price, string details) { if (componentType == ComponentsEnum.Processor) { this.Processor = new Component(name, price, details); } if (componentType == ComponentsEnum.GraphicsCard) { this.GraphicsCard = new Component(name, price, details); } if (componentType == ComponentsEnum.Motherboard) { this.Motherboard = new Component(name, price, details); } }