ToString() public méthode

public ToString ( ) : string
Résultat string
        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;
            }
        }
Exemple #2
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());
        }
Exemple #3
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;
            }
        }
Exemple #5
0
        static void Main()
        {
            Laptop laptop = new Laptop("HP 250 G2", 699.00m);
            Console.WriteLine(laptop.ToString());

            Laptop laptop2 = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "ntel 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, 2259.00m);
            Console.WriteLine(laptop2.ToString());

            Laptop laptop3 = new Laptop("PRO", "8-core, 5 GHz", 32, "100 TB", 10000.00m);
            Console.WriteLine(laptop3.ToString());
        }
        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());
        }
Exemple #7
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());
        }
Exemple #8
0
        static void Main()
        {
            Laptop laptop = new Laptop("HP 250 G2", 699.00m);

            Console.WriteLine(laptop.ToString());


            Laptop laptop2 = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "ntel 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, 2259.00m);

            Console.WriteLine(laptop2.ToString());


            Laptop laptop3 = new Laptop("PRO", "8-core, 5 GHz", 32, "100 TB", 10000.00m);

            Console.WriteLine(laptop3.ToString());
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Laptop fullSample = 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",
                "Li-Ion, 4-cells, 2550 mAh",
                4.5,
                2259.00m);

            Laptop mandatorySample = new Laptop("HP 250 G2", 699.00m);

            Console.WriteLine(fullSample);
            Console.WriteLine();
            Console.WriteLine(mandatorySample.ToString());
        }
Exemple #10
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());
        }
Exemple #11
0
        static void Main()
        {
            Laptop laptop = new Laptop("Acer 21", 1244.12, "asd", "asd");

            Console.WriteLine(laptop.ToString());
        }