// Name: formatNumber // Purpose: To make the given number's length be a multiple of 3 and reverse it. // Description: Finds the number's real length based on whether it is positive or negative and uses // that information to adjust the length accordingly and reverse it. private static void formatNumber(string[] values, out int userNumber, out int sign, out int numberLength, out string reverseString) { // If the number is not a signed 32 bit integer, or if // the user has provided too many arguments, inform them // and exit the program. userNumber = Program.IsValidInput(values); // Determine whether the user's number is a negative or positive number // and adjust length accordingly. sign = Math.Sign(userNumber); numberLength = sign >= 0 ? userNumber.ToString().Length : userNumber.ToString().Length - 1; // Reverses the user's number and make its length a multiple of 3 in // order to convert the number to english. NumberFormatter formatter = new NumberFormatter(); reverseString = formatter.reverseNumber(userNumber); formatter.formatNumberLength(ref reverseString, sign, ref numberLength); }