Question: The Interface it is an interface remember the interface definition Interfaces are often compared to a contract, to a promise to implement the methods described







The Interface
- it is an interface
- remember the interface definition
-
Interfaces are often compared to a contract, to a promise to implement the methods described in the interface. An interface in Java does not have any real code for implementation of its methods, it has only the skeleton of the methods. When a class decides to implement an interface, it has to contain the real code for each method in the interface.
-
- These are the five methods that FootballPlayerData has to implementf
-
public void loadTable(); It needs to be called in the constructor to make the table ready and available right away. It loads real data into the array list. The FootballPlayerData starter class has a method that help with this task. The method ReadPlayersFromXML( ) read the FootballPlayer objects from an XML file and load them into the players ArrayList.
-
public ArrayList
getTable(); Returns the full table of data. Although right now is not required, soon you will need this method to return a specific ArrayList instead of a generic ArrayList. -
public ArrayList
getHeaders(); The method will return an ArrayList of Strings with the names of the FootballPlayer fields (the "headers"). -
public ArrayList
getLine(int line); The method will return an ArrayList of Strings with the values of the FootballPlayer object in a chosen line "n" in the table. -
public ArrayList
> getLines(int firstLine, int lastLine); This methods used the getLine( ) method. It gets a set of lines (each one of them an array of Strings) from getLine( int n) and adds them to an array of arrays. It returns this array of arrays.
-
Do not use the scanner class or any other user input request. You application should be self-contained and run without user input. Assignment Objectives 1. Practice on implementing interfaces in Java o Football Player Data will implement the interface TableData 2. Overriding methods o when Football Player Data implements TableData, Football Player Data will have to write the real Java code for all the interface abstract methods Deliverables A zipped Java project according to the How to submit Labs and Assignments guide. O.O. Requirements (these items will be part of your grade) 1. One class, one file. Don't create multiple classes in the same.java file 2. Don't use static variables and methods 3. Encapsulation: make sure you protect your class variables and provide access to them through get and set methods 4. all the classes are required to have a constructor that receives all the attributes as parameters and update the attributes accordingly 5. Follow Horstmann's Java Language Coding Guidelines 6. Organized in packages (MVC - Model - View Controller) Contents TableData public void load Table(); public ArrayList getTable(); public ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
