static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; Battery batteryExample1 = new Battery("6-клетъчна"); Battery batteryExample2 = new Battery("Ni-Cd", (float)4.5); Laptop laptopExample1 = new Laptop("ASUS N56JN-CN047D", 1899m); Laptop laptopExample2 = new Laptop( "ASUS N56JN-CN047D", 1899m, "ASUS", "Intel Core i7-4700HQ (4-ядрен, 2.40 - 3.40 GHz, 6MB кеш)", "12GB (1x 8192MB + 1x 4096MB) - DDR3, 1600Mhz", "NVIDIA GeForce 840M (2GB DDR3)", "870GB (120GB SSD + 750GB HDD (7200 оборотa/минута))", "15.6-инчов (39.62 см.) - 1920x1080 (Full HD), матов", batteryExample2 ); Laptop laptopExample3 = new Laptop(model: "ASUS N56JN-CN047D", price: 2000m, graphicsCard: "NVIDIA GeForce 840M (2GB DDR3)"); Console.WriteLine(laptopExample1.ToString()); Console.WriteLine(); Console.WriteLine(laptopExample2.ToString()); Console.WriteLine(); Console.WriteLine(laptopExample3.ToString()); }
static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; try { Laptop a = new Laptop("Lenovo Yoga 2 Pro", 2259.00M, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", new Battery("Li-Ion", 4, 2550), 4.5d); Console.WriteLine(a.ToString()); Console.WriteLine(); Laptop b = new Laptop("HP 250 G2", -699.00M); Console.WriteLine(b.ToString()); Console.WriteLine(); Laptop c = new Laptop("HP", 92, "Intel HD Graphics 4400", "128GB SSD", "14\"", new Battery("Ni-MH", 3, 2550), 2.5); Console.WriteLine(c.ToString()); Laptop d = new Laptop("", -5); Console.WriteLine(d.ToString()); } catch (ArgumentOutOfRangeException ex) { Console.Error.WriteLine(ex.ParamName + " " + ex.Message); } catch (ArgumentException ex) { Console.Error.WriteLine(ex.Message); } }
static void Main(string[] args) { Battery b1 = new Battery("Li-Lon, 4100 mAH", 12); Laptop laptop = new Laptop("Lenovo", 12123, "faewfaew", "fawhts", "12ad", "aegeh3", "12aawe", "aefew", b1); Console.WriteLine(laptop.ToString()); }
static void Main(string[] args) { Battery first = new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5); Laptop fullInfo = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "\"13.3\"(33.78 cm) – 3200 x 1800(QHD +), IPS sensor display",first, 2259.00m); Laptop sampleInfo = new Laptop("HP 250 G2", 699.0m); Console.WriteLine("Full info: \n"+fullInfo.ToString()); Console.WriteLine(); Console.WriteLine("Sample info: \n"+sampleInfo.ToString()); }
static void Main(string[] args) { Battery first = new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5); Laptop fullInfo = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "\"13.3\"(33.78 cm) – 3200 x 1800(QHD +), IPS sensor display", first, 2259.00m); Laptop sampleInfo = new Laptop("HP 250 G2", 699.0m); Console.WriteLine("Full info: \n" + fullInfo.ToString()); Console.WriteLine(); Console.WriteLine("Sample info: \n" + sampleInfo.ToString()); }
static void Main(string[] args) { Battery battery = new Battery("Li-Ion", 4, 2550, 4.5); Laptop hpPC = new Laptop("HP 250 G2", 699.00); Laptop lenovoPC = new Laptop("Lenovo Yoga Pro 2", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "13.3\"(33.78 cm) – 3200 x 1800(QHD +), IPS sensor display", battery, 2259.00); Console.WriteLine(hpPC.ToString()); Console.WriteLine(lenovoPC.ToString()); }
static void Main() { Laptop laptop1 = new Laptop( "Lenovo Yoga 2 Pro", 2259.00m, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400", "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", "Li-Ion, 4-cells, 2550 mAh", 4.5); Laptop laptop2 = new Laptop("HP 250 G2", 699.00m); Console.WriteLine(laptop1.ToString()); Console.WriteLine(laptop2.ToString()); //Laptop laptop3 = new Laptop("", -1); }