示例#1
0
 public override string ToString()
 {
     return(string.Format(
                "License number: {1}{0}Model: {2}{0}Status: {3}{0}{4}{0}{5}{0}{6}{0}{7}% of {8} capacity if full.",
                Environment.NewLine,
                r_LicenseNumber,
                r_Model,
                m_Status,
                m_Owner.ToString(),
                m_WheelsList[0].ToString(),
                m_Engine.ToString(),
                m_PercentageOfEnergy,
                m_Engine.Type.ToString()));
 }
示例#2
0
        public override string ToString()
        {
            StringBuilder vehicleInfo = new StringBuilder();

            vehicleInfo.Append(string.Format("The license number of the vehicle is {0}.{1}", r_LicenseNumber, Environment.NewLine));
            vehicleInfo.Append(string.Format("The model of the vehicle is {0}.{1}", m_ModelName, Environment.NewLine));
            vehicleInfo.Append(m_OwnerInfo.ToString());
            for (int i = 0; i < m_Wheels.Count; i++)
            {
                vehicleInfo.Append(string.Format("Wheel number {0}:{1}", i + 1, Environment.NewLine));
                vehicleInfo.Append(m_Wheels[i].ToString());
            }

            vehicleInfo.Append(r_Engine.ToString());
            vehicleInfo.Append(string.Format("The current percentage of engine energy is {0}.{1}", m_CurrentPercentageOfEngineEnergy, Environment.NewLine));
            return(vehicleInfo.ToString());
        }