コード例 #1
0
        private static string MakeName(Make make2)
        {
            string makeName = "";

            if (make2 == Make.other)
            {
                Console.WriteLine("Please enter make of your car: ");
                Console.WriteLine("\n\t Enter 'e' to exit");
                makeName = Console.ReadLine();
                if (makeName == "e")
                {
                    makeName = null;
                    EnterToContinue();
                    Console.Clear();
                    return(makeName);
                }
                else if (makeName.Length <= 10)
                {
                    EnterToContinue();
                    Console.Clear();
                    return(makeName);
                }
                else
                {
                    Console.WriteLine("Color name must be shorter than 10 letters. Please, try again...");
                }
            }
            else
            {
                EnterToContinue();
                Console.Clear();
                return(make2.ToString());
            }
            EnterToContinue();
            Console.Clear();
            return(makeName);
        }
コード例 #2
0
 public override string GetCarInfo()
 {
     return(Make.ToString() + " | " + Year + " | " + Color.ToString() + " | " + Convert.ToString(FormatMoney(Price)) + " | " + HorsePower.ToString());
 }
コード例 #3
0
 public override string ToString() //prints used car details
 {
     return(Year.ToString() + " " + Make.ToString() + " " + Model.ToString() + " (Used) with " + Mileage.ToString() + " miles for $" + Price.ToString() + " Car ID: " + Id.ToString());
 }
コード例 #4
0
 public virtual string ToString() //prints new car details
 {
     return(Year.ToString() + " " + Model.ToString() + " " + Make.ToString() + " for $" + Price.ToString() + " Car ID: " + Id.ToString());
 }
コード例 #5
0
 public override string ToString()
 {
     return(Make.ToString() + " " + Name);
 }
コード例 #6
0
ファイル: Car.cs プロジェクト: S00189636/labSheet
 public override string ToString()
 {
     return(Make.ToString() + "\n" + Model.ToString() + "\n" + CurrentSpeed.ToString() + "\n" + EngineSize.ToString());
 }