using System; namespace Project5_14 { /// /// Summary description for Class1. /// class SoccerGame { private int score1; //score of team 1 private int score2; //score of team2 //Define the constructor, which initializes both teams' scores to be 0 public SoccerGame() { score1 = score2 = 0; } //Method to add 1 to score of team 1 public void ScoreTeam1() { score1++; } //Method to add 1 to score of team 2 public void ScoreTeam2() { score2++; } //Method to display the scores of both team in the game. public void Display() { Console.WriteLine("The scores are {0}-{1}", score1, score2); } /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { //Create two objects of class SoccerGame SoccerGame game1 = new SoccerGame(); SoccerGame game2 = new SoccerGame(); //For each game, set scores of both teames game1.ScoreTeam1(); game1.ScoreTeam1(); game1.ScoreTeam1(); game1.ScoreTeam2(); game1.ScoreTeam2(); game1.Display();//The score would be "3:2" game2.ScoreTeam1(); game2.Display(); //The score would be "1:0" } } }