Question: 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.

 Do not use the scanner class or any other user inputrequest. You application should be self-contained and run without user input. AssignmentObjectives 1. Practice on implementing interfaces in Java o Football Player willimplement the interface Table Member 2. Overriding methods o when Football Playerimplements TableMember, Football Player will have to write the real Java code

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 will implement the interface Table Member 2. Overriding methods o when Football Player implements TableMember, Football Player 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 TableMember Person String name Height height int weight String hometown String highSchool public String getAttribute(int n); public ArrayListgetAttributes(); public String getAttributeName(int n); public ArrayList getAttributeNames(); String toString() extends implements Football Player Height int feet int inches int number String position String toString() {...} public String getAttribute(int n){...} public ArrayListgetAttributes() {...} public String getAttributeName(int n) {...} public ArrayListgetAttributeNames() {...} String toString() FootballPlayer will implement the interface TableMember writing real code for all the abstract methods. app Model model = new Model(); Model Football player fp = new Football Player(2, "Marcus Allen", ....); Sys...println(fp.getAttributes().toString(); for (int i = 0; i O Model > Search Results Output - A03_Solution_FootballPlayerTableMember (run) 8 run: [Marcus Allen, 6'2", 209, Upper Marlboro, MD, Dr. Henry A. Wise, 2, S] [Marcus Allen, 6'2", 209, Upper Marlboro, MD, Dr. Henry A. Wise, 2, S] 0 = name - Marcus Allen 1 = height - 6'2" 2 = weight - 209 3 = hometown - Upper Marlboro, MD 4 = highSchool - Dr. Henry A. Wise 5 = number 6 = position - S [name, height, weight, hometown, highSchool, number, position] (name, height, weight, hometown, highSchool, number, position] BUILD SUCCESSFUL (total time: 0 seconds) o it creates a FootballPlayer object o uses this object to test and display the result of the newly implemented methods . getAttribute(int n) getAttributes() getAttributeName(int n) getAttributeNames() Person o has the following attributes String name; Height height; . int weight; String hometown; String highSchool; o and a method String toString() toString() overrides the superclass Object toString() method . toString() returns information about this class attributes as a String o encapsulation . if you want other classes in the same package yo have access to the attributes, you need to make them protected instead of private. see more about encapsulation here. FootballPlayer o has the following attributes int number; String position; o has the following method from the previous lab String toString() toString() overrides the superclass Object toString() method toString() returns information about this class attributes as a String o and the methods coming from the interface TableMember getAttribute(int n) getAttributes() getAttributeName(int n) . getAttributeNames() Height o it is a class (or type) which is used in FootballPlayer defining the type of the attribute height o it has two attributes . int feet; . int inches o 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: 5'2" The Interface TableMember Minimize File Preview package Model; import java.util.ArrayList; public interface TableMember public String getattribute(int n); public ArrayList getAttributes(); public String getAttributeName (int n); public ArrayList getAttributeNames (); } 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 four methods that FootballPlayer has to implement public String getAttribute(int n); Returns the value of a specific attribute. The input parameter start with e for the first attribute, then 1 for the second attribute and so on. public Arraylist getAttributes (); Returns the value of all attributes as an ArrayList of Strings. public String getAttributeName (int n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!