Exemple #1
0
        public static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;

            //components graphics
            Components graphicsCardRadeon = new Components("XFX Radeon HD 5450 1GB 64-bit DDR3", 51.22m);
            Components graphicsCardASUS = new Components("ASUS HD6450-SL-1GD3-BRK", 75.00m);
            Components graphicsCardGigabyte = new Components("Gigabyte GV-N660WF2-2GD", 345.00m);

            //Processors
            Components processorIntel = new Components("Intel Celeron G1820", 64.09m);
            Components processorAMD = new Components("AMD A4-Series X2 4020", 78.00m);
            Components processorIntelCorei5 = new Components("Intel Core i5-4460 (6M Cache, up to 3.40 GHz)", 360.00m);

            //Motherboard
            Components motherboardASROCK = new Components("ASROCK AM1B-M", 50.00m);
            Components motherboardASROCK2 = new Components("ASROCK FM2A55M-VG3+", 81.00m);
            Components motherboardASUS = new Components("ASUS GRYPHON Z87", 263.00m);

            //Computers
            Computer computer1 = new Computer("Lenovo", new List<Components> { graphicsCardRadeon, processorIntel, motherboardASROCK });
            Computer computer2 = new Computer("ASUS", new List<Components> { graphicsCardASUS, processorAMD, motherboardASROCK2 });
            Computer computer3 = new Computer("ASUS", new List<Components> { graphicsCardGigabyte, processorIntelCorei5, motherboardASUS });

            List<Computer> computers = new List<Computer> { computer1, computer2, computer3 };

            computers.OrderByDescending(computer => computer.Price).ToList()
                .ForEach(computer => Console.WriteLine(computer.ToString()));
        }
        static void Main(string[] args)
        {
            List<Computer> computers = new List<Computer>();

            Computer PC1 = new Computer(
                name: "ASUS",
                motherboard: new Component("Asus AK-47", 334m, "mini form factor"),
                processor: new Component("i7 2345", 234m, "64 cores"),
                ram: new Component("32GB", 200m, "DDR5"));

            Computer PC2 = new Computer(
                name: "GigaBUUUG",
                motherboard: new Component("Gigabyte AZ32", 144m, "mini form factor"),
                processor: new Component("i5 2345", 134m, "32 cores"),
                ram: new Component("16GB", 100m, "DDR5"));

            Computer PC3 = new Computer(
                name: "Handmade",
                motherboard: new Component("Marmalad duno", 112m),
                processor: new Component("i3 2200", 104m),
                ram: new Component("8GB", 80m));

            computers.Add(PC1);
            computers.Add(PC2);
            computers.Add(PC3);

            computers = computers.OrderBy(o => o.totalPrice).ToList();

            foreach (var computer in computers)
            {
                Console.WriteLine(computer);
                Console.WriteLine();
            }
        }
Exemple #3
0
 static void Main(string[] args)
 {
     List<Component>parts=new List<Component>()
     {
         new Component("RAM",12m),
         new Component("DVD",14m),
         new Component("CPU",234m)
     };
     Computer MyComp = new Computer("Dell",parts);
     MyComp.GetName();
     MyComp.GetComponents();
     MyComp.GetPrice();
     Console.WriteLine(MyComp);
 }
Exemple #4
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Console.OutputEncoding = Encoding.UTF8;

            Component processor1 = new Component("INTEL 5.5", 15341.4m, "4 GHz, 8 core");
            Component processor2 = new Component("INTEL 6", 56.4m);
            Component graphCard1 = new Component("NVIDIA 567HG", 646.4m);
            Component graphCard2 = new Component("NVIDIA 67456HG", 6846.4m, "bad @$$ video card");
            Component graphCard3 = new Component("NVIDIA 100HG", 6846.4m, "@ video card");
            Component motherboard1 = new Component("Nfsfsf", 246.4m);
            Component motherboard2 = new Component("Nfsfsadasdsf", 346.4m);

            Computer comp1 = new Computer("PC1", new List<Component> { processor1, graphCard1, motherboard2 });
            Computer comp2 = new Computer("PC2", new List<Component> { processor1, graphCard2, motherboard1 });
            Computer comp3 = new Computer("PC3", new List<Component> { processor2, graphCard3, motherboard2 });

            Computer[] computers = new Computer[]{comp3, comp2, comp1};

            Array.Sort(computers, (a, b) => a.Price.CompareTo(b.Price));

            computers.ToList().ForEach(Console.WriteLine);
        }
Exemple #5
0
        static void Main(string[] args)
        {

            SortedDictionary<decimal, Computer> list = new SortedDictionary<decimal, Computer>();
            Computer comp1 = new Computer("Laptop", new Component("cpu", 46.33), new Component("asus", 218.44),
                new Component("Nvidia", 184.93), new Component("Toshiba", 163.88), new Component("Kingston", 277.19));
            Computer comp2 = new Computer("Desktop PC", new Component("Intel i5-5500M", 258.22, "Very good CPU"), new Component("ASUS-KB-73G2", 391.90, "High performance mainboard"),
                null, new Component("Seagate", 155.84, "500GB"), new Component("Kingston", 299.95, "HyperX memory"));
            Computer comp3 = new Computer("Netbook", new Component("Intel Atom", 163.88, "netbook version"), null, null, new Component("Samsung 200GB", 138.47), new Component("DDR3 1600Mhz", 120.41));

            list.Add(comp1.Price, comp1);
            list.Add(comp2.Price, comp2);
            list.Add(comp3.Price, comp3);

            foreach (var item in list)
            {
                Console.WriteLine(item.Value);
            }
        }