Exemplo n.º 1
0
 public static void Main()
 {
     Battery battery = new Battery(130, BatteryType.LiPo);
     Laptop laptop = new Laptop("Galaxy S5", "Samsung", "Snapdragon", "Quadra", battery, 5.5, 800);
     Console.WriteLine(laptop);
     Console.ReadKey();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {

            Laptop laptop = new Laptop("Lenovo Yoga 2 Pro", 200m);
            Console.WriteLine(laptop);

            Laptop laptop1 = new Laptop("Lenovo Yoga 2 Pro", 2000m, "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",
                "Li-Ion, 4-cells, 2550 mAh", 4.5);

            Console.WriteLine(laptop1);

            Console.WriteLine();

            Battery battery = new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5);
            Laptop laptop2 = new Laptop("Lenovo Yoga 2 Pro", 200m, null, null, null, null, null, null, battery);
            Console.WriteLine(laptop2);

            Console.WriteLine();
            Battery battery2 = new Battery("Li-Ion, 4-cells, 2550 mAh");
            Laptop laptop3 = new Laptop("Acer 2013l", 3000m, "acer", null, null, null, null, null, battery2);
            Console.WriteLine(laptop3);


        }
Exemplo n.º 3
0
 public Laptop(string model, string manufacturer,string battery, double price)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.battery = new Battery(battery);
     this.Price = price;
 }
Exemplo n.º 4
0
 static void Main(string[] args)
 {
     Console.WriteLine("Laptop model: ");
     string model = Console.ReadLine();
     Console.WriteLine("Manufacturer: ");
     string manifacturer = Console.ReadLine();
     Console.WriteLine("Processor: ");
     string processor = Console.ReadLine();
     Console.WriteLine("RAM: ");
     string ram = Console.ReadLine();
     Console.WriteLine("Graphic card: ");
     string card = Console.ReadLine();
     Console.WriteLine("HDD: ");
     string hdd = Console.ReadLine();
     Console.WriteLine("Screen: ");
     string screen = Console.ReadLine();
     Console.WriteLine("Battery type: ");
     string batType = Console.ReadLine();
     Console.WriteLine("Battery life: ");
     double batLife = double.Parse(Console.ReadLine());
     Battery battery = new Battery(batType, batLife);
     Console.WriteLine("Price: ");
     decimal price = decimal.Parse(Console.ReadLine());
     Laptop laptop = new Laptop(model, manifacturer, processor, ram, card, hdd, screen, battery, price);
     Console.WriteLine(laptop);
     Console.WriteLine(battery);
 }
Exemplo n.º 5
0
        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)
        {
            Battery sampleBat = new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5);
            Laptop sampleInfo = new Laptop("Lenovo Yoga 2 Pro", 2259.00);
            Laptop middleInfo = 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", 2259.00, sampleBat);
            Laptop fullInfo = 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 inch (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display ", 2259.00, sampleBat);

            Console.WriteLine("If you want to see  info only for model and price press 1 and then enter");
            Console.WriteLine("If you want see full info press 2 and then enter");
            Console.WriteLine("If you want see info without hdd and screen press 3 and then enter");

            string input = Console.ReadLine();

            switch(input)
            {
                case "1":
                    Console.WriteLine(sampleInfo.ToString());
                    break;
                case "2":
                    Console.WriteLine(fullInfo.ToString());
                    break;
                case "3":
                    Console.WriteLine(middleInfo.ToString());
                    break;
                default:
                    Console.WriteLine("you cannot choice other variants");
                    break;
            }
        }
Exemplo n.º 7
0
 static void Main()
 {
     Battery lion = new Battery("lion", 5);
     Laptop firstLaptop = new Laptop("Lenovo-Yoga", "Lenovo", "Dual core 2 Duo", "8GB", "G-Force", "1TB", "21 inch", lion, 1000);
     Laptop secondLaptop = new Laptop("Hp-Aspire", 1000);
     Console.WriteLine(firstLaptop);
     Console.WriteLine(secondLaptop);
 }
Exemplo n.º 8
0
 public Laptop(string model,decimal price,Battery battery = null)
 {
     this.model = model;
     this.price = price;
     if (battery != null)
     {
         this.batteryName = battery.BatteryName;
         this.life = battery.Life;
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Laptop" /> class.
 /// </summary>
 /// <param name="model">Model of the laptop.</param>
 /// <param name="manufacturer">Manufacturer of the laptop.</param>
 /// <param name="processor">Processor model.</param>
 /// <param name="graphicCard">Build in graphic card.</param>
 /// <param name="battery">Battery specifications.</param>
 /// <param name="screenSize">Size of the screen in inches.</param>
 /// <param name="price">Laptop price in Euro.</param>
 public Laptop(string model, string manufacturer, string processor, string graphicCard, Battery battery = null, double screenSize = 4.0, decimal price = 0.0m)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Processor = processor;
     this.GraphicCard = graphicCard;
     this.ScreenSize = screenSize;
     this.Price = price;
     this.Battery = battery ?? new Battery();
 }
Exemplo n.º 10
0
 public Laptop(string model, string manufacturer, string processor, int ram, string graphicsCard, double price, Battery battery)
 {
     this.Model = model;
     this.Manufactorer = manufacturer;
     this.Processor = processor;
     this.RAM = ram;
     this.GraphicsCard = graphicsCard;
     this.Price = price;
     this.Battery = battery;
 }
Exemplo n.º 11
0
 public Laptop(string model, string manufacturer, string processor, string ram, string graphicCard, string hdd, string screen, Battery battery, decimal price)
     : this(model, price)
 {
     this.Manifacturer = manufacturer;
     this.Processor = processor;
     this.Ram = ram;
     this.GraphicCard = graphicCard;
     this.Hdd = hdd;
     this.Screen = screen;
     this.battery = Battery;
 }
Exemplo n.º 12
0
 public Laptop(string model, decimal price, string manufacturer = null, string processor = null, string ram = null, string hdd = null, string graphicsCard = null, Battery battery = null, string screen = null)
     : this(model, price)
 {
     this.Manufacturer = manufacturer;
     this.Processor = processor;
     this.Ram = ram;
     this.Hdd = hdd;
     this.GraphicsCard = graphicsCard;
     this.Battery = battery;
     this.Screen = screen;
 }
Exemplo n.º 13
0
 public Laptop(string model, decimal price, string manufacturer = null, string cpu = null, string ram = null, string hdd = null,
     string gpu = null, Battery battery = null, string screen = null) : this (model, price)
 {
     this.Manufacturer = manufacturer;
     this.CPU = cpu;
     this.RAM = ram;
     this.HDD = hdd;
     this.GPU = gpu;
     this.Battery = battery;
     this.Screen = screen;
 }
Exemplo n.º 14
0
 public Laptop(string model, string manufacturer, string processor, int ram,
     string graphicsCard, string hdd, string screen, Battery battery, decimal price) : this(model, price)
 {
     Manufacturer = manufacturer;
     Processor = processor;
     Ram = ram;
     GraphicsCard = graphicsCard;
     Hdd = hdd;
     Screen = screen;
     Battery = battery;
 }
Exemplo n.º 15
0
 public Laptop(string model, string manifacturer, string processor, int ram, string gpu, int hdd, string screen, Battery battery, decimal price)
 {
     this.Model = model;
     this.Manifacturer = manifacturer;
     this.Processor = processor;
     this.Ram = ram;
     this.Gpu = gpu;
     this.Hdd = hdd;
     this.Screen = screen;
     this.battery = battery;
     this.Price = price;
 }
Exemplo n.º 16
0
 public Laptop(string model, string manufacturer, string processor, string ram, string graphicscard, string hdd, string screen, Battery battery, decimal 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;
     this.Price = price;
 }
Exemplo n.º 17
0
 public Laptop(string model,
     string manufacturer,
     string processor,
     string graphicsCard,
     Battery battery,
     string screenSize,
     decimal price) : this(model, processor, graphicsCard, price)
 {
     this.Manufacturer = manufacturer;
     this.battery = battery;
     this.ScreenSize = screenSize;
 }
Exemplo n.º 18
0
Arquivo: Laptop.cs Projeto: T316/OOP
 public Laptop(string model, string manufacturer, 
     string processor, int ram, string graphicsCard, string hdd, string screen, string batteryModel, double batteryLife, decimal price)
 {
     this.Model = model;
     this.Price = price;
     this.Manufacturer = manufacturer;
     this.Processor = processor;
     this.RAM = ram;
     this.GraphicsCard = graphicsCard;
     this.HDD = hdd;
     this.Screen = screen;
     battery = new Battery(batteryModel, batteryLife);
 }
Exemplo n.º 19
0
 public Laptop(string model, decimal price, string manufacturer = null,
     string processor = null, string ram = null, string graphicCard = null,
     string hdd = null, string screen = null, Battery battery = null)
 {
     this.Model = model;
     this.Price = price;
     this.Manufacturer = manufacturer;
     this.Processor = processor;
     this.Ram = ram;
     this.GraphicCard = graphicCard;
     this.Hdd = hdd;
     this.battery = battery;
 }
Exemplo n.º 20
0
 public Laptop(string model, string manufacturer, string processor, int ram,
     string grapthicCard, string hdd, string screen, string battery, double batteryLife, double price)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Processor = processor;
     this.Ram = ram;
     this.GraphicCard = grapthicCard;
     this.Hdd = hdd;
     this.Screen = screen;
     this.battery = new Battery(battery, batteryLife);
     this.Price = price;
 }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            Battery lion = new Battery("Li-Ion, 4-cells, 2550 mAh");
            Battery nicd = new Battery("Ni-Cd", (float)4.5);
            Laptop lpt_first = new Laptop("Lenovo Yoga 2 Pro", (decimal)869.88, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "128GB SSD", "Intel HD Graphics 4400",lion, "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display");
            Laptop lpt_second = new Laptop("Aspire E3-111-C5GL",  (decimal)259.49);
            Laptop lpt_third = new Laptop("Acer some model", (decimal)1567.43,battery:nicd,processor:"3.2 GHz", ram:"16 GB");

            Console.WriteLine(lpt_first.ToString());
            Console.WriteLine();
            Console.WriteLine(lpt_second.ToString());
            Console.WriteLine();
            Console.WriteLine(lpt_third.ToString());
        }
Exemplo n.º 22
0
        public Laptop(string man, string model, double price, string cpu, string gpu, string ram, string hdd, string screen, Battery battery)
            : this(model, price)
        {
            if (string.IsNullOrEmpty(cpu) || string.IsNullOrEmpty(gpu) || string.IsNullOrEmpty(man)
                || string.IsNullOrEmpty(hdd) || string.IsNullOrEmpty(ram))
            {
                throw new ArgumentNullException("Empty String");
            }

            this.Manufacturer = man;
            this.Battery = battery;
            this.Processor = cpu;
            this.GraphicsCard = gpu;
            this.Screen = screen;
            this.RAM = ram;
            this.HDD = hdd;
        }
Exemplo n.º 23
0
        public static void Main(string[] args)
        {
            Laptop lenovo = new Laptop("HP 250 G2", 649);
            Console.WriteLine(lenovo);

            Console.WriteLine();

            var battery = new Battery(4.5, "Li-Ion, 4-cells, 2550 mAh");
            Laptop siemens = new Laptop(
                           "Lenovo",
                           "Lenovo Yoga 2 Pro", 
                           2259,
                           "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
                           "Intel HD Graphics 4400",
                           "8 GB",
                           "128GB SSD",
                           "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
                           battery);

            Console.WriteLine(siemens);
        }
Exemplo n.º 24
0
 public Laptop(string model, decimal price, Battery battery)
 {
     this.Model = model;
     this.Price = price;
     this.batteryDescr = battery;
 }
Exemplo n.º 25
0
 public Laptop(string model, double price, string manufacturer = null, string processor = null, int ram = 0, string graphicsCard = null, int hdd = 0, string screen = null, Battery battery = null)
     : this(model, price)
 {
     this.Manufacturer = manufacturer;
     this.Processor    = processor;
     this.Ram          = ram;
     this.GraphicsCard = graphicsCard;
     this.Hdd          = hdd;
     this.Screen       = screen;
     this.Battery      = battery;
 }
Exemplo n.º 26
0
 public Laptop(string model, decimal price, string manufacturer = null, string processor = null, string ram = null,
               string graphicsCard = null, string hardDisc = null, string screen = null, Battery battery = null)
     : this(model, price)
 {
     this.Manufacturer = manufacturer;
     this.Processor    = processor;
     this.Ram          = ram;
     this.GraphicsCard = graphicsCard;
     this.HardDisc     = hardDisc;
     this.Screen       = screen;
     this.Battery      = battery;
 }
Exemplo n.º 27
0
 public Laptop(string model, decimal price, string manifacturer, string processor, string graphicsCard, Battery battery, string screen)
     : this(model, price, manifacturer)
 {
     this.Processor    = processor;
     this.GraphicsCard = graphicsCard;
     this.Battery      = battery;
     this.screen       = screen;
 }
Exemplo n.º 28
0
 public Laptop(string model, decimal price, string manufacturer, string processor, int ram, string graphicsCard, string hdd, string screen, double batteryLife, Battery battery)
 {
     this.Model        = model;
     this.Price        = price;
     this.Manufacturer = manufacturer;
     this.Processor    = processor;
     this.RAM          = ram;
     this.GraphicsCard = graphicsCard;
     this.HDD          = hdd;
     this.Screen       = screen;
     this.BatteryLife  = batteryLife;
     this.Battery      = battery;
 }
Exemplo n.º 29
0
 public Laptop(string model, Battery battery)
 {
     this.Model = model;
     this.battery = battery;
 }
Exemplo n.º 30
0
 public Laptop(string model, double price, Battery battery, string manufact)
     : this(model, price)
 {
     this.batt     = battery;
     this.Manufact = manufact;
 }
Exemplo n.º 31
0
        static void Main()
        {
            Battery lion = new Battery("Li-Ion, 4-cells, 2550 mAh");
            Battery nimh = new Battery("Ni-Mh", 4.5f);
            Laptop lapFirst = new Laptop("HP 250 G2", 699.00m);
            Laptop lapSecond = new Laptop("Lenovo Yoga 2 Pro", 2259.00m, "Lenovo",
                    "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "128GB SSD", 
                    "Intel HD Graphics 4400", lion, "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display");
            Laptop thirdLap = new Laptop("Dell model", 1523.95m, battery: nimh, processor: "3.2GHz", ram: "4GB");

            Console.WriteLine(lapFirst.ToString());
            Console.WriteLine();
            Console.WriteLine(lapSecond.ToString());
            Console.WriteLine();
            Console.WriteLine(thirdLap.ToString());
        }
Exemplo n.º 32
0
 public Laptop(string model, string manufacturer, string processor, string ram, string graphicsCard, string hdd, string screen, Battery battery, decimal price)
     : this(model, manufacturer, processor, ram, graphicsCard, hdd, price)
 {
     this.Screen = screen;
     this.Battery = battery;
 }
Exemplo n.º 33
0
 public void AddBattery(Battery battery)
 {
     this.batt = battery;
 }