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 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:
- scorePoints: This method should take the name of a player and a number of points as arguments. It should add the specified number of points to the specified player's score.
- getPoints: This method should take the name of the player as an argument. It should retunr the total number of points earned by that player.
- getTotalPoints: This method should return the total number of points earned by both players on the team.
- printSummary: This method should print to the screen (not return) a summary of the scorecard including exactly the teamName and the totalScore, as in the example:
Super Heros: 15
- Please also include the canonical toString and equals methods.
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.