public void WriteOutputFile() { var flightSummary = _flightService.CalculateFlightSummaryReport(); _outputText = new StringBuilder(); try { _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalPassengerCount)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.GeneralPassengerCount)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.AirlinePassengerCount)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.LoyaltyPassengerCount)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalNumberOfBags)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalLoyaltyPointsRedeemed)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalCostOfFlight)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalUnadjustedTicketRevenue)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.TotalAdjustedRevenue)); _outputText.AppendFormat(string.Format("{0} ", flightSummary.CanFlightProceed ? "TRUE" : "FALSE")); _outputText.AppendFormat(string.Format("{0} ", flightSummary.DiscountedPassengerCount)); File.WriteAllText(FileHelper.GetOutputFile(), _outputText.ToString()); } catch (Exception ex) { DisplayMessage.ShowErrorMessage(ex); } finally { _outputText = null; } Console.WriteLine("\n Output result has been written sucessfully..!\n"); Console.WriteLine("\n Press any key to exit the flight console application."); Console.ReadLine(); }