Assume the following Sport class has already been written:…
Assume the following Sport class has already been written: public class Sport { private String name; private int numPlayers; public Sport(String name, int numPlayers) { this.name = name; this.numPlayers = numPlayers; } public String getName() { return name; } public int getNumPlayers() { return numPlayers; } public String toString() { return “Sport: ” + name + “, Number of Players: ” + numPlayers; }} A TeamSport contains 4 things: a name, numPlayers, numTeams and duration. The name is a String and the other 3 are ints. You must create the TeamSport class. The following “main” method must work correctly given your TeamSport class. public static void main(String teamSports = { new TeamSport(“Soccer”, 11, 20, 95), new TeamSport(“Basketball”, 5, 30, 48), new TeamSport(“Hockey”, 6, 32, 60), new TeamSport(“Football”, 11, 32, 60) }; // Passed in as name, numPlayers, numTeams and then duration. teamSports.setDuration(90); System.out.println(teamSports.getNumberTeams()); // Prints out 30 System.out.println(teamSports.getName()); // Prints out exactly this: Sport is Hockey Arrays.sort(teamSports); // TeamSports with the shortest duration are first. // If there is a tie with duration, then the team with the smallest number of players is first. for (TeamSport teamSport : teamSports) { System.out.println(teamSport); }} When the teamSport is printed out for the Soccer item, the string that prints out is exactly the following: Number of Teams: 2, Duration: 90 minutes, Sport: Soccer, Number of Players: 11 Some things to note with your code: You must only include the methods needed for the main method to work. Do not include extra methods in your TeamSport class. Your TeamSport class must use inheritance and interfaces well. In other words, you should have no redundant code in your TeamSport class.