public Laptop(string model, decimal price, string manufacturer = null, string processor = null, int? ram = null, string graphicCard = null, string hdd = null, string screen = null, Battery battery = null) { this.Model = model; this.Price = price; this.Manufacturer = manufacturer; this.Processer = processor; this.Ram = ram; this.GraphicCard = graphicCard; this.Hdd = hdd; this.Screen = screen; this.Battery = battery; }
static void Main() { Laptop firstLap = new Laptop("Lenovo Yoga 2 Pro", (decimal)2259.00); Battery lion = new Battery("Li-Ion, 4-cells, 2550 mAh"); Battery nicd = new Battery("Ni-Cd", (float)4.5); Console.WriteLine(firstLap.ToString()); Console.WriteLine(); Laptop secondLap = new Laptop("Lenovo yoga", (decimal)2321, "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", nicd); Console.WriteLine(secondLap.ToString()); }
//Constructor all info + battery info public Laptop(string model, string manufacturer, string processor, int ram, string card, string hdd, string screen, Battery battery, double batteryLife, decimal price) { this.Model = model; this.Manufacturer = manufacturer; this.Processor = processor; this.RAM = ram; this.Card = card; this.HDD = hdd; this.Screen = screen; this.Battery = battery; this.BatteryLife = batteryLife; this.Price = price; }
public Laptop(string model, string manufacturer, string processor, int ram, string graphicsCard, string hdd, string screen, Battery battery, decimal price) : this(model, price) { this.Model = model; this.Manufacturer = manufacturer; this.Processor = processor; this.Ram = ram; this.GraphicsCard = graphicsCard; this.Hdd = hdd; this.Screen = screen; this.battery = battery; }
static void Main() { Battery toshiba = new Battery("qkoShiba", 4.5m); Laptop shtaiga = new Laptop ( "Lenovo Yoga 2 Pro", "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", toshiba, 2259.00m ); Laptop model = new Laptop("Ebanie", 200.00m); Laptop fourPar = new Laptop("4-ka pravec", "pravec procesor", "zdrav hard", 400.00m); Laptop sevenPar = new Laptop("7-ca pravec", "made in bulgaria", "pravec procesor", 4, "mnoo zdrav hard", "ekran ta drynka", 700.00m); Console.WriteLine("Shtaiga -> all"); Console.WriteLine(shtaiga.ToString()); Console.WriteLine("Ebanie -> Model & Price"); Console.WriteLine(model.ToString()); Console.WriteLine("4-ka pravec -> 4 par"); Console.WriteLine(fourPar.ToString()); Console.WriteLine("sedmak pravec -> 7 par"); Console.WriteLine(sevenPar.ToString()); }
public Laptop(string model, decimal price, Battery battery) { this.Model = model; this.Price = price; this.Batt = battery; }