}//end Housekeeping static string Decision(BaseballGame game) { string winner; if (game.scoreOne > game.scoreTwo) { winner = String.Format($"{game.teamOne} Wins!!"); } else if (game.scoreTwo > game.scoreOne) { winner = String.Format($"{game.teamTwo} Wins!!"); } else { winner = String.Format($"{game.teamOne} tied {game.teamTwo}"); } return(winner); } //end Decision
static void Main(string[] args) { //DECLARATIONS string primer; string EXIT = "EXIT"; BaseballGame [] scores = new BaseballGame[1]; primer = HouseKeeping(); while (primer != EXIT) { for (var i = 0; i < scores.Length; i++) { scores[i] = new BaseballGame(); //Define team 1 System.Console.WriteLine("Please enter a name for team 1"); scores[i].teamOne = Console.ReadLine(); //Define team 2 System.Console.WriteLine("Please enter a name for team 2"); scores[i].teamTwo = Console.ReadLine(); //Define score 1 for team 1 System.Console.WriteLine($"Enter the score for Team: {scores[i].teamOne}"); scores[i].scoreOne = Convert.ToInt32(Console.ReadLine()); //Define score 2 for team 2 System.Console.WriteLine($"Enter score for Team: {scores[i].teamTwo}"); scores[i].scoreTwo = Convert.ToInt32(Console.ReadLine()); System.Console.WriteLine($"{scores[i].teamOne}: {scores[i].scoreOne} vs. {scores[i].teamTwo}: {scores[i].scoreTwo}"); System.Console.WriteLine(Decision(scores[i])); primer = Rerun(); } } }//end main