public void GetStatus() { validParkingLotExists(); //Finding the greatest string length and beautifying the outout in a table format int slotLength = ParkingLotStrings.SlotNumberText.Length, regNoLength = ParkingLotStrings.RegistrationNumberText.Length; foreach (var slot in _slotToRegMap.Keys) { slotLength = (slot.ToString().Length > slotLength) ? slot.ToString().Length : slotLength; regNoLength = (_slotToRegMap[slot].Length > regNoLength) ? _slotToRegMap[slot].Length : regNoLength; } //Adding a gap of 7 spaces between the columns string slotGap = ""; for (int i = 0; i < (slotLength - ParkingLotStrings.SlotNumberText.Length + 7); i++) { slotGap += " "; } string regGap = ""; for (int i = 0; i < regNoLength - ParkingLotStrings.RegistrationNumberText.Length + 7; i++) { regGap += " "; } output.Print(HelperMethods.BeautifyStatusOutput(ParkingLotStrings.SlotNumberText, slotLength) + HelperMethods.BeautifyStatusOutput(ParkingLotStrings.RegistrationNumberText, regNoLength) + ParkingLotStrings.ColourText); foreach (var key in _slotToRegMap.Keys) { output.Print(string.Format("{0}{1}{2}", HelperMethods.BeautifyStatusOutput(key.ToString(), slotLength), HelperMethods.BeautifyStatusOutput(_slotToRegMap[key], regNoLength), _regToColourMap[_slotToRegMap[key]])); } return; }