Results 1 to 3 of 3
- 04-23-2011, 06:15 PM #1Member
- Join Date
- Apr 2011
- Rep Power
Football Roster coursework help needed!
I need some help tackling an exercise I have to complete. I have tried several ways, below are the specifications of the assignment, I would like to know how you would tackle this.
Hope you can help.
A local football club wishes to store information on its current squad of players:
Each Player’s personal information (first name, last name, age, height and weight) should be recorder in a class Person. Each Player’s record for the season should be stored in a class Player. The information stored for each player consists of the number of games played and goals scored. Write a class Goalkeeper which in addition records the number of penalties that the goalkeeper has saved. Provide appropriate methods for accessing this information. You should make appropriate use of inheritance in your solution.
Information on all Players should be stored in a class Club. Club stores the name of the club and maintains information about all of it's players. Club has methods to add and remove Players addPlayer(Player p) and removePlayer(Player p). It should also contain a method to retrieve a Player’s details given her/his first and last names. (You may assume that no two Players have identical first and last names).
Write classes Person, Player, Goalkeeper and Club that satisfy the above specification. Write a class Test that contains a main method that tests your implementations and prints out the information held about each player in the club. When a new player is signed, she/he should be inserted into the Club class in alphabetical order of last name (and first name if last names are the same). To do this make your Person and Player class implement the appropriate Comparable interface.
Write a class ComparePlayers that implements the Comparator<Player> interface. It should compare players by number of games played (and then by alphabetical order of surname if the number of games played is the same). Implement a new Constructor for the Club class that takes a Comparator<Player> parameter. Hence write a main program that will print information about each player in the club where players are listed by decreasing order of games played. This should allow ordering to be dictated by the main program without modifying the code in any of your other classes.
The main problem for me at the moment, is making a sort of list that holds data of the players. First name, last name, age, height, and weight. I tried 5 arrays which worked, until they asked me to sort the players according to last name and goals scored. How can I make a list, that in one block, or one element, holds all the information of ONE player?
Please help me! :D
- 05-12-2011, 08:09 PM #2Member
- Join Date
- Apr 2011
- Rep Power
Last edited by randoms:); 05-12-2011 at 10:16 PM.
- 05-13-2011, 10:10 AM #3
- By RSYR in forum New To JavaReplies: 2Last Post: 11-24-2010, 07:46 PM
- By receme in forum Java GamingReplies: 2Last Post: 09-01-2010, 03:49 PM
- By university in forum New To JavaReplies: 2Last Post: 11-06-2008, 06:14 AM
- By miahj in forum New To JavaReplies: 2Last Post: 11-29-2007, 05:37 AM
- By email@example.com in forum EclipseReplies: 1Last Post: 08-09-2007, 07:24 PM