public override string ToString()
        {
            StringBuilder result = new StringBuilder();
            string        TreatmentDetails;

            TreatmentDetails = string.Format(
                @"Owner name: {0}
Owner phone: {1}
Vehicle status: {2}
",
                m_OwnerName,
                m_OwnerPhoneNum,
                m_CarStatus.ToString());
            result.Append(TreatmentDetails);
            result.Append(m_Vehicle.ToString());

            return(result.ToString());
        }
예제 #2
0
        public override string ToString()
        {
            StringBuilder vehicleString = new StringBuilder();

            vehicleString.AppendFormat("Model Name: {0}, ", m_Model);
            vehicleString.AppendFormat("License Number: {0} , ", m_LicenseNumber);
            vehicleString.AppendFormat("Remaining Energy: {0}% ", m_EnergyPrecentege);
            vehicleString.AppendLine();
            vehicleString.AppendFormat("Energy Source: {0}", m_PowerSystem.ToString());
            vehicleString.AppendLine();
            vehicleString.AppendFormat("Vehicle statuse: {0}", m_CarStatus.ToString());
            vehicleString.AppendLine();
            vehicleString.AppendFormat("Wheels: ");
            vehicleString.AppendLine();
            foreach (Wheel wheel in m_Wheels)
            {
                vehicleString.AppendFormat(wheel.ToString());
                vehicleString.AppendLine();
            }
            return(vehicleString.ToString());
        }