Beispiel #1
0
 public Computer(string name, Component processor, Component graphicsCard, Component motherboard)
 {
     this.Name = name;
     computerProcessor = processor;
     computerGraphicsCard = graphicsCard;
     computerMotherboard = motherboard;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 public Computer(string name, Component processor, decimal price)
     : this(name, processor, null, null)
 {
     this.Name = name;
     computerProcessor = processor;
 }
Beispiel #5
0
 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;
        }
Beispiel #7
0
		private void InizializeComponents(Component[] components)
		{
			foreach (var component in components) {
				this.components.Add(component);
			}
		}
Beispiel #8
0
 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);
            }
        }