Example #1
0
        /// <summary>
        /// Method AddToStock
        /// adds cars to list
        /// </summary>

        override public void AddToStock()
        {
            string brand = string.Empty;
            string model = string.Empty;
            int    count;
            int    cost;

            Printer printer = new Printer();

            // reads information about brand of car
            printer.PrintFormForAdd("brand");
            brand = Console.ReadLine();

            // reads information about model of car
            printer.PrintFormForAdd("model");
            model = Console.ReadLine();

            // reads information about count of cars
            printer.PrintFormForAdd("count");
            count = int.Parse(Console.ReadLine());

            // reads information about cost of car
            printer.PrintFormForAdd("cost");
            cost = int.Parse(Console.ReadLine());

            Car car = new Car(brand, model, count, cost);

            // add car into list
            recordsAboutCars.Add(car);

            Console.WriteLine("Car is added");
        }
        /// <summary>
        /// Method AddToStock
        /// adds trucks to list
        /// </summary>

        override public void AddToStock()
        {
            string brand = string.Empty;
            string model = string.Empty;
            int    count;
            int    cost;

            Printer printer = new Printer();

            // reads information about brand of truck
            printer.PrintFormForAdd("brand");
            brand = Console.ReadLine();

            // reads information about model of truck
            printer.PrintFormForAdd("model");
            model = Console.ReadLine();

            // reads information about count of trucks
            printer.PrintFormForAdd("count");
            count = int.Parse(Console.ReadLine());

            // reads information about cost of trucks
            printer.PrintFormForAdd("cost");
            cost = int.Parse(Console.ReadLine());

            Truck truck = new Truck(brand, model, count, cost);

            // add truck into list
            recordsAboutTrucks.Add(truck);

            Console.WriteLine("Truck is added");
        }