Question: PLEASE READ EVERYTHING COPY AND PASTE THE CODE BELOW Assignment Objectives 1.Practice on implementing interfaces in Java FootballPlayer will implement the interface TableMember 2.Overriding methods
PLEASE READ EVERYTHING
COPY AND PASTE THE CODE BELOW
Assignment Objectives
1.Practice on implementing interfaces in Java
FootballPlayer will implement the interface TableMember
2.Overriding methods
when FootballPlayer implements TableMember, FootballPlayer 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.All the classes are required to have an "empty" constructor that receives no parameters but updates all the attributes as needed
6.Follow Horstmann's Java Language Coding Guidelines
7.Organized in packages (MVC - Model - View Controller)
Contents







Contents app Creates model and controller objects Person String name Height height int weight String hometown String highschool Table Member public String getAttribute public ArrayListgetMembers setMembersArrayList arr) needs to use System.out.print instead of System.out.printin number position name height weight hometown highSchool 37 CB Kyle Alston 59 180 Robbinsville, NJ. Robbinsville - Person uses encapsulation private attributes a get and a set method for each attribute has the following attributes String name: Height height: int weight: String hometown: - String highschool o has two constructors one with no parameters one with all the parameters (one for each attribute a toString() method a toString() method Football Player has the following attributes int number: String position two constructors one with no parameters one with all the parameters (one for each attribute) and a method String toString) .toStringt ) overrides the superclass Object toStringl ) method .toStrinel) returns information about this class attributes as a String Height it is a class for type) which is used in Person defining the type of the attribute height uses encapsulation private attributes a get and a set method for each attribute It has two attributes int feet: int inches two constructors one with no parameters . one with all the parameters fone for each attributel and a method String toString) .toString) overrides the superclass Object toString) method .toString) returns information about this class attributes as a String it returns a formatted String with feet and inches for instance: 52 The Interface . it is an interface remember the interface definition Interfaces are often corred to a contract, to prostu plement the the described th the interface An interface in Javedor not have any real code for implementation of its sethods to the skeleton of the methods When a class decides to plement an interface, it has to contain the real code for de method in the interface the four methods that nothallPlave Iniment Beste .toString) returns information about this class attributes as a String it returns a formatted String with feet and inches for instance: 5 2 The Interface TableMember - 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 inplementation of its thodsIt has only the skeleton of the methods When a class decides to implement on Interface, it has to contain the real code for each method in the interface. These are the four methods that Football Player has to Implement public String getAttribute(int). Returns the value of a specific attribute the input peronter start with a for the first attribute, then I for the second attr bute and so on public ArrayList String getAttributes: Returns the value of all ottributes os on ArrayList of Strings - public String getAttributeName(int n). Neturns the name of a specific attribute. The input parameter start with o for the first attribute, then 1 for the second stri ute and son public ArrayList-String getAttributions: Returns the name of all attributes o an ArrayList of Strings the abstract sheds are You are building an application to display data in the form of a table. This is the first step With Football player implementing TableMember Football Player objects can be displayed in a table. The methods you are implementing will support that Below a screenshot of the graphics application in a future assignment that will use what you are building now. ng TableMember Football Player objects can be displayed in a table. The methods you are implementing will support that. Below a screenshot of the graphics application in a future assignment that will use what you are building non public string getAttributestame(int n) publie ArrayListAttributes) puble string grattribute(int) publte ArrayLittring getAttenda A strategy o if you develop getAttribute(int n) first, then you can use it in getAttributes() with a for loop getting each getah The other way is also true, if you develop getAttributes() first, then you can use it to retrieve one element at a getAttributes(int n). The same is true for getAttributeName(int n) and getAttributeNames(). Output pubble Big Leit ) publie Array ( ) A strategy o if you develop getAttribute(int n) first, then you can use it in getAttributes() with a for loop getting each get The other way is also true, if you develop getAttributes() first, then you can use it to retrieve one element a getAttributes(int n). . The same is true for getAttributeNamelint n) and getAttributeNames(). Output It should look like: height 5.99 number position name height weight hometown highSchool 37 CB Kyle Alston 5'9" 188 Robbinsville, N.J. Robbinsville size of names=7 size of attributes 7