$29
Purpose
To review interfaces and basic ArrayList usage.
Direc5ons:
Your task is to write a class called BasketballPlayer. Your class should have the following fields and methods:
private String firstName
private String lastName
private double ppg (points per game)
public BasketballPlayer – constructor that iniFalizes the fields of this object
public String toString – returns a String of the form lastName, firstName (ppg)
Your BasketballPlayer class also needs to implement the Comparable interface so that basketball players can be compared to one another. Players should be sorted first by points per game (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 BasketballPlayer objects
Put the player objects into an ArrayList
Print out the ArrayList
Sort the ArrayList
Print out the ArrayList a second Fme
Example output:
[Smith, Jay (12.7), Smith, DeShaun (12.7), Taylor, DeShaun (18.1)] [Taylor, DeShaun (18.1), Smith, DeShaun (12.7), Smith, Jay (12.7)]
When your program is working, export your NetBeans project to a zip file (File -> Export Project-> To Zip) and upload it to the dropbox in Pilot. Name you file CS1181-PracFce2-YourLastName.zip, where YourLastName is replaced by your last name.