Inlab 4: Golf League
Due: Friday 12 February at 6:00 pm
Purpose
- Get more experience with programs involves interacting
classes.
- Address type-casting issues.
Partners
This is an individual assignment, though collaboration (not
solution sharing) is allowed.
Problem Statement
You will build a program that represents golf teams. To do
this, you need two classes.
The Player class will represent a golfer and the Team
class will represent a golf team.
A Player will consist of a name, the number of rounds of golf played, and the total number of shots or score for all of the rounds. A Team
will consist of four (exactly four) Players
and a team name. You will then build methods that will calculate
the round average of the individual players
and the overall team. NOTE: Round Average = score / numRounds.
Assignment
- Create a project called Inlab4.
- Copy this code into a class called
Driver. As discussed in class last week, you can gain a ton
of information about the classes and methods you need to build
from this code.
- Correctly implement the methods you need to get the Driver to
compile and run. HINT: It may be easiest to have the
printStats() method in the Team class (repeatedly) call a
printStats() method in the Player class.
- If implemented correctly, your output will look like this.
Submission
By Friday evening at 6:00 pm, submit the files Player.java,
and Team.java into the appropriate D2L dropbox folder. DO
NOT SUBMIT .class files.
Grading - 10 points
- 4 points - The new classes compile with the provided Driver.
- 2 points - The round average for a player is correctly
calculated, in the Player class, using type-casting.
- 2 points - The round average for a team is correctly
calculated, in the Team class, using type-casting.
- 1 points - The output looks like the output provided.
- 1 points - Good programming principles are followed (minimal
unnecessary code, efficient solution,...).