Lab 1 - Scorecard
Due: Thursday, May 29th at 11:59pm


This assignment asks you to write a Java class specification for objects that model a Scorecard. Each scorecard consists of a teamName, the names of each of the two players on the team, player1 and player2, and the total points earned so far for each of the players, pointsEarnedPlayer1 and pointsEarnedPlayer2.

It also asks you to write a main() method that serves as a test driver. The test driver should call each method of the class, in a meaningful way, and, in so doing, demonstrate the correctness of the Scorecard.

The Details

The description above should give you a really good hint about the name of the class and of the names of the instance variables. It should be pretty straight-forward to pick the right type for the names. In considering the type to use for the points variables, keep in mind that scores can't have fractions, just whole points, and that they aren't likely to get super humongous.

The name of the team and the names of the players should be set by the constructor, which should take the team name, and each of the players' names as arguments. It should also initialize the points fields to zero.

The class should have methods as below:

The test driver should create a new instance of the Scorecard and, one more than one occasion, add points to each of the players. It should then get the score for each of the players and print it out. lastly, it should then call the method to print out the summary of the scorecard.


We'll talk about this in class on Thursday.