Beispiel #1
0
 public static string TaxiNameAusgabe(Taxi auto)
 {
     return(auto.Händler + " " + auto.Modell);
 }
Beispiel #2
0
        public static int TaxinamenAusgabe(int unternehmen, int hersteller)
        {
            //TODO Eingabe überprüfen
            string taxiAuswahl;

            switch (hersteller)
            {
            case 0:
                for (int i = 0; i < Hersteller.Audi.Fuhrpark.Count; i++)
                {
                    Console.WriteLine(i + 1 + ". " + Taxi.TaxiNameAusgabe(Hersteller.Audi.Fuhrpark[i]));
                }
                Console.Write("\n\nBitte waehlen Sie ein Modell aus:\t");
                taxiAuswahl = Console.ReadLine();
                Regex zahl = new Regex("^[0-9]+$");
                while (true)
                {
                    if (zahl.IsMatch(taxiAuswahl) && Convert.ToInt32(taxiAuswahl) > 0 && Convert.ToInt32(taxiAuswahl) <= Hersteller.Audi.Fuhrpark.Count)
                    {
                        return(Convert.ToInt32(taxiAuswahl) - 1);
                    }
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.Write("\nUngueltige Eingabe!\nBitte neues Modell waehlen:\t");
                    Console.ResetColor();
                    taxiAuswahl = Console.ReadLine();
                    //todo Console.Clear();
                }

            case 1:
                for (int i = 0; i < Hersteller.BMW.Fuhrpark.Count; i++)
                {
                    Console.WriteLine(i + 1 + ". " + Taxi.TaxiNameAusgabe(Hersteller.BMW.Fuhrpark[i]));
                }
                Console.Write("\n\nBitte waehlen Sie ein Modell aus:\t");
                taxiAuswahl = Console.ReadLine();
                Regex zahl1 = new Regex("^[0-9]+$");
                while (true)
                {
                    if (zahl1.IsMatch(taxiAuswahl) && Convert.ToInt32(taxiAuswahl) > 0 && Convert.ToInt32(taxiAuswahl) <= Hersteller.BMW.Fuhrpark.Count)
                    {
                        return(Convert.ToInt32(taxiAuswahl) - 1);
                    }
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.Write("\nUngueltige Eingabe!\nBitte neues Modell waehlen:\t");
                    Console.ResetColor();
                    taxiAuswahl = Console.ReadLine();
                    //todo Console.Clear();
                }

            case 2:
                for (int i = 0; i < Hersteller.MercedesBenz.Fuhrpark.Count; i++)
                {
                    Console.WriteLine(i + 1 + ". " + Taxi.TaxiNameAusgabe(Hersteller.MercedesBenz.Fuhrpark[i]));
                }
                Console.Write("\n\nBitte waehlen Sie ein Modell aus:\t");
                taxiAuswahl = Console.ReadLine();
                Regex zahl2 = new Regex("^[0-9]+$");
                while (true)
                {
                    if (zahl2.IsMatch(taxiAuswahl) && Convert.ToInt32(taxiAuswahl) > 0 && Convert.ToInt32(taxiAuswahl) <= Hersteller.BMW.Fuhrpark.Count)
                    {
                        return(Convert.ToInt32(taxiAuswahl) - 1);
                    }
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.Write("\nUngueltige Eingabe!\nBitte neues Modell waehlen:\t");
                    Console.ResetColor();
                    taxiAuswahl = Console.ReadLine();
                    //Console.Clear();
                }

            default:
                TaxinamenAusgabe(unternehmen, hersteller);
                return(-1);
            }
        }
Beispiel #3
0
 public static string kompletteAusagbe(Taxi auto)
 {
     return("\n\nAuto:\t\t" + auto.Händler + " " + auto.Modell + "\nAntrieb:\t" + auto.Antrieb + "\nBauart:\t\t" + auto.Bauart + "\nSitzplaetze:\t" + auto.Sitzplaetze + "\nBaujahr:\t" + auto.Baujahr + "\nKilometerstand:\t" + auto.Kilometerstand + "\n\nPreis:\t" + MainClass.ZahlenAnzeigen(auto.Preis) + " Euro.");
 }