Ejemplo n.º 1
0
        static void Two()
        {
            Console.WriteLine("-------------------AUTOMOBILE-------------------");
            Automobile automobile = new Automobile("Volkswage",
                                                   220,
                                                   "Black");

            Console.WriteLine(automobile.GetInfo());
            automobile.Update();
            Console.WriteLine(automobile.GetInfo());
            Console.WriteLine("-------------------SPORTCAR-------------------");
            Sportcar sportcar = new Sportcar("Lamborghini",
                                             350,
                                             "Yellow",
                                             2);

            Console.WriteLine(sportcar.GetInfo());
            sportcar.Update();
            Console.WriteLine(sportcar.GetInfo());
            Console.WriteLine("-------------------EXECUTIVECAR-------------------");
            ExecutiveCar executiveCar = new ExecutiveCar("BMW", 250,
                                                         "Grey", true);

            Console.WriteLine(executiveCar.GetInfo());
            executiveCar.Update();
            Console.WriteLine(executiveCar.GetInfo());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            List <Car> cars = new List <Car>();
            bool       run  = true;

            while (run)
            {
                Write("Was möchten sie machen?(1 = Auto eingeben, 2 = zeig alle Autos, 3 = Beenden )");
                int select = ReadInt();
                if (select == 2)
                {
                    foreach (Car oneCar in cars)
                    {
                        Console.WriteLine(oneCar.ToString());
                    }
                    break;
                }
                if (select == 3)
                {
                    run = false;
                    break;
                }
                Write("Welchen Autotyp wünschen Sie?(1 = Sportauto, 2 = Standardauto)Bitte Zahl eingeben:");
                int      type    = ReadInt();
                CarTypes carType = CarTypes.Normalcar;
                if (type == 1)
                {
                    carType = CarTypes.Sportcar;
                }
                Write("Welchen Name hat das Auto?");
                string carName = Read();
                Write("Welchen Hersteller hat das Auto?");
                string carBrand = Read();
                Write("Welches Baujahr hat das Auto?");
                int carConstructionYear = ReadInt();
                Write("Welche Farbe hat das Auto?");
                string carColor = Read();
                Write($"Ihr Auto: {carType} {carName} {carBrand} {carConstructionYear} {carColor}");
                if (type == 1)
                {
                    Sportcar sportcar = new Sportcar(carName, carBrand, carConstructionYear, carColor);
                    cars.Add(sportcar);
                }
                else if (type == 2)
                {
                    Car car = new Car(carName, carBrand, carConstructionYear, carColor);
                    cars.Add(car);
                }
            }

            Console.ReadKey();
        }
Ejemplo n.º 3
0
    static void Main()
    {
        Auto obj1 = new Auto();

        obj1.AutoInfo();

        Sportcar obj = new Sportcar();

        obj.InfoSportcar();

        Minicar obj2 = new Minicar();

        obj2.MinicarInfo();

        Console.ReadLine();
    }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Sportcar     sport   = new Sportcar("BMW", 250, 650);
            Bus          bus     = new Bus("MAZ", 155, 4500);
            Truck        truck   = new Truck("MAN", 240, 6000);
            PassengerCar passCar = new PassengerCar("Opel", 200, 2500);

            Game game = new Game();

            game.AddToRace(sport);
            game.AddToRace(bus);
            game.AddToRace(truck);
            game.AddToRace(passCar);
            game.OnStart();
            game.Go();

            Console.ReadKey();
        }
Ejemplo n.º 5
0
        public static Sportcar CreateSportCar()
        {
            Console.WriteLine("Hersteller eingeben:");
            string Hersteller = Console.ReadLine();

            Console.WriteLine("Typ eingeben:");
            string Typ = Console.ReadLine();

            Console.WriteLine("Name eingeben:");
            string Name = Console.ReadLine();

            Console.WriteLine("Farbe eingeben:");
            string Farbe = Console.ReadLine();

            Console.WriteLine("Baujahr eingeben:");
            int      Baujahr  = int.Parse(Console.ReadLine());
            Sportcar Sportcar = new Sportcar(Typ, Hersteller, Name, Farbe, Baujahr);

            return(Sportcar);
        }