Question: Purpose To review interfaces and basic Acraylist usage. Directions: Your task is to write a class called Golfer. Your class should have the following fields
Purpose
To review interfaces and basic Acraylist usage.
Directions:
Your task is to write a class called Golfer. Your class should have the following fields and methods: private String firstName
private String last Name
private int score the golfer's score so far this round
private int thru the number of holes the golfer has completed so far this round
public Golfer constructor that initializes the fields of this object
public String tostcing returns a String of the form lastName firstName; score through thru
Your Golfer class also needs to implement the Comparable interface so that golfers can be compared to one another. Players should be sorted first by score lower comes first then by the number of holes they are through higher comes first then lexicographically by last name ignoring case and finally lexicographically by first name.
You also need to create a class called Driver.java with a main method. In main:
Create three Golfer objects
Put the golfer objects into an Acraylist
Print out the Arraxlist
Sort the Arraxlist
Print out the Acraylist a second time
Example output:
Smith Jay: through Smith, DeShaun: through Taylor, DeShaun: through
Smith Jay: through Smith, DeShaun: through Taylor, DeShaun: through
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
