コード例 #1
0
ファイル: Computer.cs プロジェクト: T316/OOP
 public Computer(string name, Component processor, Component graphicsCard, Component motherboard)
 {
     this.Name = name;
     computerProcessor = processor;
     computerGraphicsCard = graphicsCard;
     computerMotherboard = motherboard;
 }
コード例 #2
0
ファイル: PCCatalog.cs プロジェクト: ivan4otopa/SoftUni
 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;
 }
コード例 #3
0
ファイル: PCCatalog.cs プロジェクト: DiyanaSt/OOP
        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;
        }
コード例 #4
0
ファイル: Computer.cs プロジェクト: T316/OOP
 public Computer(string name, Component processor, decimal price)
     : this(name, processor, null, null)
 {
     this.Name = name;
     computerProcessor = processor;
 }
コード例 #5
0
ファイル: PCCatalog.cs プロジェクト: craghagBg/AllProjects
 static void Main()
 {
     Component component = new Component();
     component.VGA = "Radeon R280";
     Console.WriteLine(component.VGA);
 }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
ファイル: Computer.cs プロジェクト: zhecho1215/HomeWorks
		private void InizializeComponents(Component[] components)
		{
			foreach (var component in components) {
				this.components.Add(component);
			}
		}
コード例 #8
0
ファイル: Computer.cs プロジェクト: craghagBg/AllProjects
 public Computer(string name, decimal price, Component components)
     : this(name, price)
 {
     this.Components = components;
 }
コード例 #9
0
        /// <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);
            }
        }