private string formatHistogramData(CovidStatistics theStatisticsToFormat) { string outputString = Environment.NewLine; int currentIndex = 0; foreach (var currentNumberOfDays in theStatisticsToFormat.HistogramDataContents) { if (currentNumberOfDays == theStatisticsToFormat.HistogramDataContents.First()) { outputString += Environment.NewLine + "0 - 500: " + thousandsCommaPlacer(currentNumberOfDays); } else { outputString += Environment.NewLine + thousandsCommaPlacer((currentIndex * 500) + 1) + " - " + thousandsCommaPlacer((currentIndex * 500) + 500) + ": " + thousandsCommaPlacer(currentNumberOfDays); } currentIndex++; } return(outputString); }
public CovidInformationInterpreter() { this.covidInformationList = new StackedStringArray(); this.theProcessedCovidStatistics = new CovidStatistics(); this.theProcessedMonthlyCovidStatisticses = new List <MonthlyCovidStatistics>(); this.firstPositiveTestDate = "000000"; this.firstTestDate = "000000"; }
private string formatStatistics(CovidStatistics theStatisticsToFormat) { string outputString = "The first positive test occurred on " + stringToDateFormat(theStatisticsToFormat.DateFirstPositiveTest); outputString += Environment.NewLine + "The highest number of positive tests was " + thousandsCommaPlacer(theStatisticsToFormat.NumberPositiveTestsHighest) + " on " + stringToDateFormat(theStatisticsToFormat.DatePositiveTestsHighest); outputString += Environment.NewLine + "The highest number of negative tests was " + thousandsCommaPlacer(theStatisticsToFormat.NumberNegativeTestsHighest) + " on " + stringToDateFormat(theStatisticsToFormat.DateNegativeTestsHighest); outputString += Environment.NewLine + "The highest number of all tests was " + thousandsCommaPlacer(theStatisticsToFormat.NumberAllTestsHighest) + " on " + stringToDateFormat(theStatisticsToFormat.DateAllTestsHighest); outputString += Environment.NewLine + "The highest number of deaths was " + thousandsCommaPlacer(theStatisticsToFormat.NumberDeathsHighest) + " on " + stringToDateFormat(theStatisticsToFormat.DateDeathsHighest); outputString += Environment.NewLine + "The highest number of hospitalizations was " + thousandsCommaPlacer(theStatisticsToFormat.NumberHospitalizationsHighest) + " on " + stringToDateFormat(theStatisticsToFormat.DateHospitalizationsHighest); outputString += Environment.NewLine + "The highest percentage of positive tests was " + theStatisticsToFormat.NumberPositiveTestsHighestPercent + " on " + stringToDateFormat(theStatisticsToFormat.DatePositiveTestsHighestPercent); outputString += Environment.NewLine + "The average number of positive tests are " + thousandsCommaPlacer(theStatisticsToFormat.AverageNumberOfPositiveTests); outputString += Environment.NewLine + "The overall positivity of the tests are " + thousandsCommaPlacer(theStatisticsToFormat.OverallPositivityRate); outputString += Environment.NewLine + "The number of days with more than 2500 positive tests are " + thousandsCommaPlacer(theStatisticsToFormat.NumberOfDaysPositiveTestsAboveThreshold); outputString += Environment.NewLine + "The number of days with less than 1000 positive tests are " + thousandsCommaPlacer(theStatisticsToFormat.NumberOfDaysPositiveTestsBelowThreshold); outputString += formatHistogramData(theStatisticsToFormat); outputString += formatMonthlyStatistics(); return(outputString); }