CS 1401 Assignment #12

Date Assigned: Tuesday, November 22, 2005 or Wednesday, November 23, 2005.

Due Date: before the end of your last lab session, on Wednesday November 30 or on Thursday December 1, 2005.

Goals: to learn how to use arrays of objects.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

Assignment: This assignment is a continuation of Assignment 11 about the UTEP soccer team. As in that assignment, the results of all the games are stored in a file in which each line represents a score. For example, 5:3 means that the UTEP team scored 5 goals, while the opposite team scored only 3 goals.

In soccer, a win (like 5:3) brings 2 points, a tie (like 3:3) brings 1 point, and a loss (like 3:5) brings 0 points. The team with the largest number of points wins. If two or more teams get the same number of points, then the referees decide which of these teams is the champion by looking at the overall numbers of goals scored and goals missed by each of these teams.

The difference with the previous assignment is that instead of two arrays of numbers, we will now have arrays of objects.

Define a class GameScore; each object of this class must have a field gained and a field missed. For example, if the score of a game is 5:3, then the field gained should contain 5 and the field missed should contain 3. Use encapsulation; in other words, make sure that these fields are private and are only accessible via methods.

Write an application that:

Example (same as in Assignment 11)

If UTEP played 3 games, with scores 5:3, 1:2, and 7:0, then:

The overall number of points gained is thus 2 + 0 + 2 = 4. Also:

Deliverables: as announced in the labs.