Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

After reading allL02content pages inLesson 02: Inheritance and Interfaces,you will complete thisassignment according to the information below. Do not use the scanner class or any other user input...

1 answer below »
After reading allL02content pages inLesson 02: Inheritance and Interfaces,you will complete thisassignment according to the information below.
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
Practice on implementing inheritance in Java
FootballPlayer will extend a new class, Person
Ove
iding methods
toString( )(Links to an external site.)which is a method from the Object class, will be implemented in OffensiveLine, FootballPlayer, Person and Height
Keep working with more complex classes
in the same way that FootballPlayer had a class as an attribute (Height height), OffensiveLine will have FootballPlayer as an attribute
Deliverables
A zipped Java project according to theHow to submit Labs and Assignments guide.
O.O. Requirements (these items will be part of your grade)
One class, one file. Don't create multiple classes in the same .java file
Don't use static variables and methods
Encapsulation:make sure you protect your class variables and provide access to them through get and set methods
All the classes are required to have a constructor that receivesallthe attributes as parameters and update the attributes accordingly
All theclasses are required to have an "empty" constructor that receivesnoparameters but updates all the attributes as needed
FollowHorstmann's Java Language Coding Guidelines
Organized in packages (MVC - Model - View Controller)
Contents
L02_Description.png
Create a Netbeans project (or keep developing from your previous lab) with
App.java
Model
Model.java
FootballPlayer.java
Height.java
Person.java
OffensiveLine.java
Functionality
The application App creates a Model object
The Model class
creates 3 FootballPlayer objects
creates an OffensiveLine object using the 3FootballPlayer objects
displays information about the OffensiveLine object and its 3 players
it is arequirementthat this should be done using thetoString( )method in OffensiveLine, which will usetoString( )in FootballPlaye
displays the average height of the OffensiveLine
this will be done using the averageHeight in the OffensiveLine
The classes
App
it has themainmethod which is the method that Java looks for and runs to start any application
it creates an object (an instance) of the Model class
Model
this is the class where all the action is going to happen
it creates three football players
it creates an OffensiveLine object using the three players
displays information about the OffensiveLine
this has to be done using the OffensiveLine object
this is really information about its 3 players
the format is free as long as it contains all the information about each of the 3 players
displays the average height of the OffensiveLine
this has to be done using the OffensiveLine object
this has to call the averageHeight method in OffensiveLine
Person
has the following attributes
String name;
Height height;
int weight;
String hometown;
String highSchool;
and a method
String toString( )
toString( ) ove
ides the superclass Object toString( ) method
toString( ) returns information about this class attributes as a String
encapsulation
if you want other classesin the same packageyo have access to the attributes, you need to make themprotectedinstead ofprivate.
see morehere.
FootballPlaye
has the following attributes
int number;
String position;
and a method
String toString( )
toString( ) ove
ides the superclass Object toString( ) method
toString( ) returns information about this class attributes as a String
Height
it is a class (or type) which is used in Person defining the type of the attributeheight
it has two attributes
int feet;
int inches
and a method
String toString( )
toString( ) ove
ides 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"
OffensiveLine
has the following attributes
FootballPlayer center;
FootballPlayer offensiveGuard;
FootballPlayer offensiveTackle;
They might also be stored in an A
ayList
and two methods
String toString( )
toString( ) ove
ides the superclass Object toString( ) method
toString( ) returns information about the 3 players attributes as a String
int averageHeight()
calculates and returns the average height of the OffensiveLine.
it is calculated based on the height of each of its player
Answered 20 days After Jun 19, 2021

Solution

Pranav answered on Jul 10 2021
154 Votes
.metadata/.lock
.metadata/.log
!SESSION 2021-07-09 14:36:06.058 -----------------------------------------------
eclipse.buildId=4.17.0.I20200902-1800
java.version=14.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY org.eclipse.jface 2 0 2021-07-09 14:40:41.237
!MESSAGE Keybinding conflicts occu
ed. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2021-07-09 14:40:41.237
!MESSAGE A conflict occu
ed for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
        Open a type in a Java editor,
        Category(org.eclipse.ui.category.navigate,Navigate,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@7b8fcdf2,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
        ,
        Category(org.eclipse.lsp4e.category,Language Servers,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@54d2f5d3,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2021-07-09 14:41:05.699
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Admin'. If this is
not co
ect please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!SESSION 2021-07-10 01:41:13.752 -----------------------------------------------
eclipse.buildId=4.17.0.I20200902-1800
java.version=14.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY org.eclipse.jface 2 0 2021-07-10 01:42:17.067
!MESSAGE Keybinding conflicts occu
ed. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2021-07-10 01:42:17.067
!MESSAGE A conflict occu
ed for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
        Open a type in a Java editor,
        Category(org.eclipse.ui.category.navigate,Navigate,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@49f1184e,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
        ,
        Category(org.eclipse.lsp4e.category,Language Servers,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@7ebaf0d,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2021-07-10 01:42:37.255
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Admin'. If this is
not co
ect please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
.metadata/.plugins/org.eclipse.core.resources/.history/1a/80c1a9709ee0001b190ac2ff328be91c
package MainApp.Model;
**
* Java class used to define the height of a person
* in our application model
* @author Admin
* @version 09/07/2021
*
public class Height {
    
    private int feet;
    private int inches;
    
    public Height()
    {    this.feet = 0;
        this.inches = 0;
    }
    
    public Height(int feet, int inches)
    {    super();
        this.feet = feet;
        this.inches = inches;
    }
    @Ove
ide
    public String toString()
    {    return "Height : "+ feet + "' " + inches + "\"";
    }
    public int getFeet()
    {    return feet;
    }
    public int getInches()
    {    return inches;
    }
}
.metadata/.plugins/org.eclipse.core.resources/.history/1f/00a816a898e0001b190ac2ff328be91c
package MainApp.Model;
public class FootballPlayer {
}
.metadata/.plugins/org.eclipse.core.resources/.history/20/702836aa9fe0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    @Ove
ide
    public String toString()
    {    return "OffensiveLine : Center = " + center
                + "\n Offensive Guard = " + offensiveGuard
                + "\n Offensive Tackle = " + offensiveTackle;
    }
    
    /**
     * A method that calculated the average height of all three
     * football player at the offensive line
     * @return
     *
    public int averageHeight()
    {    
collecting the part of the height of players which consists of
        
feet, for later converting them into inches
        int totalHeightInFeet = ( center.getHeight().getFeet()
                + offensiveGuard.getHeight().getFeet()
                + offensiveTackle.getHeight().getFeet() ) ;
        
        
converting height in feet into inches
        int totalHeightInInches = totalHeightInFeet * Height.INCHES_PER_FEET;
        
        
finally adding the part of the height of players which consists of
        
inches to get the overall sum of their heights in inches
        totalHeightInInches += center.getHeight().getInches()
                + offensiveGuard.getHeight().getInches()
                + offensiveTackle.getHeight().getInches() ;
    
        int averageHeightInInches = totalHeightInInches/3;
        
        return averageHeightInInches;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/38/603e4eeab9e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    
a default constructor for the class
    public OffensiveLine()
    {    this.center = new FootballPlayer();
        this.offensiveGuard = new FootballPlayer();
        this.offensiveTackle = new FootballPlayer();
    }
    
    public OffensiveLine(FootballPlayer center, FootballPlayer offensiveGuard, FootballPlayer offensiveTackle) {
        super();
        this.center = center;
        this.offensiveGuard = offensiveGuard;
        this.offensiveTackle = offensiveTackle;
    }
    
    @Ove
ide
    public String toString()
    {    return "OffensiveLine : Center = " + center
                + "\n Offensive Guard = " + offensiveGuard
                + "\n Offensive Tackle = " + offensiveTackle;
    }
    
    
    /**
     * A method that calculated the average height of all three
     * football player at the offensive line
     * @return
     *
    public int averageHeight()
    {    
collecting the part of the height of players which consists of
        
feet, for later converting them into inches
        int totalHeightInFeet = ( center.getHeight().getFeet()
                + offensiveGuard.getHeight().getFeet()
                + offensiveTackle.getHeight().getFeet() ) ;
        
        
converting height in feet into inches
        int totalHeightInInches = totalHeightInFeet * Height.INCHES_PER_FEET;
        
        
finally adding the part of the height of players which consists of
        
inches to get the overall sum of their heights in inches
        totalHeightInInches += center.getHeight().getInches()
                + offensiveGuard.getHeight().getInches()
                + offensiveTackle.getHeight().getInches() ;
    
        int averageHeightInInches = totalHeightInInches/3;
        
        return averageHeightInInches;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/3a/80e11b47a4e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent a football playe
* in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class FootballPlayer extends Person{
    
    private int number;
    private String position;
    
    
a default constructor for the class
    public FootballPlayer()
    {    this.number = 1;
        this.position = "Guard";
    }
    
    public FootballPlayer(int number, String position, String name,
            Height height, int weight, String hometown, String highSchool)
    {    super(name, height, weight, hometown, highSchool);
        this.number = number;
        this.position = position;
    }
    
    @Ove
ide
    public String toString()
    {    return "FootballPlayer : [ Number=" + number + ", Position=" + position + " ]";
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/44/404f6f1ef6e0001b158eb748a6b26fde
package MainApp.Model;
**
* Java class used to define the height of a person
* in our application model
* @author Admin
* @version 09/07/2021
*
public class Height {
    
    private int feet;
    private int inches;
    
    
    
a default constructor for the class
    public Height()
    {    this.feet = 0;
        this.inches = 0;
    }
    
    public Height(int feet, int inches)
    {    super();
        this.feet = feet;
        this.inches = inches;
    }
    @Ove
ide
    public String toString()
    {    return "Height : "+ feet + "' " + inches + "\"";
    }
    public int getFeet()
    {    return feet;
    }
    public int getInches()
    {    return inches;
    }
}
.metadata/.plugins/org.eclipse.core.resources/.history/4c/00637080bae0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to initialize our model
* @author Admin
* @version 1.01 09/07/2021
*
public class Model {
    public Model()
    {    
creating 3 FootballPlayer objects    
        FootballPlayer footballPlayer1 = new FootballPlayer(5, "Offense", "Wilbur",
                new Height(5,8), 67, "Chicago", "Chicago" );
        
        FootballPlayer footballPlayer2 = new FootballPlayer(8, "Offense", "Samuel",
                new Height(6,0), 75, "Boston", "Boston" );
        
        FootballPlayer footballPlayer3 = new FootballPlayer(3, "Offense", "Jade",
                new Height(5,11), 60, "Seattle", "Seattle" );
        
        
        
creating an OffensiveLine object using the 3 Football Player objects
        OffensiveLine offensiveLine =
                new OffensiveLine(footballPlayer1, footballPlayer2, footballPlayer3);
        
        
printing information about offensive line
        System.out.println(offensiveLine);
        
        
printing the average height of the offensive line
        int averageHeight = offensiveLine.averageHeight();
        System.out.println("Average height of offensive line : "
                + averageHeight / Height.INCHES_PER_FEET + "' "
                + averageHeight % Height.INCHES_PER_FEET + "\"" );
        
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/59/70d7729299e0001b190ac2ff328be91c
.metadata/.plugins/org.eclipse.core.resources/.history/59/f0e91453a4e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    
a default constructor for the class
    public OffensiveLine()
    {    this.center = new FootballPlayer();
        this.offensiveGuard = new FootballPlayer();
        this.offensiveTackle = new FootballPlayer();
    }
    
    public OffensiveLine(FootballPlayer center, FootballPlayer offensiveGuard, FootballPlayer offensiveTackle) {
        super();
        this.center = center;
        this.offensiveGuard = offensiveGuard;
        this.offensiveTackle = offensiveTackle;
    }
    
    @Ove
ide
    public String toString()
    {    return "OffensiveLine : Center " + center
                + "\n Offensive Guard = " + offensiveGuard
                + "\n Offensive Tackle = " + offensiveTackle;
    }
    
    
    /**
     * A method that calculated the average height of all three
     * football player at the offensive line
     * @return
     *
    public int averageHeight()
    {    
collecting the part of the height of players which consists of
        
feet, for later converting them into inches
        int totalHeightInFeet = ( center.getHeight().getFeet()
                + offensiveGuard.getHeight().getFeet()
                + offensiveTackle.getHeight().getFeet() ) ;
        
        
converting height in feet into inches
        int totalHeightInInches = totalHeightInFeet * Height.INCHES_PER_FEET;
        
        
finally adding the part of the height of players which consists of
        
inches to get the overall sum of their heights in inches
        totalHeightInInches += center.getHeight().getInches()
                + offensiveGuard.getHeight().getInches()
                + offensiveTackle.getHeight().getInches() ;
    
        int averageHeightInInches = totalHeightInInches/3;
        
        return averageHeightInInches;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/5a/e0107778bae0001b190ac2ff328be91c
package MainApp.Model;
**
* Java class used to define the height of a person
* in our application model
* @author Admin
* @version 09/07/2021
*
public class Height {
    
    private int feet;
    private int inches;
    
    
constant that denotes number of inches per feet
    public static final int INCHES_PER_FEET = 12;
    
    
a default constructor for the class
    public Height()
    {    this.feet = 0;
        this.inches = 0;
    }
    
    public Height(int feet, int inches)
    {    super();
        this.feet = feet;
        this.inches = inches;
    }
    @Ove
ide
    public String toString()
    {    return "Height : "+ feet + "' " + inches + "\"";
    }
    public int getFeet()
    {    return feet;
    }
    public int getInches()
    {    return inches;
    }
}
.metadata/.plugins/org.eclipse.core.resources/.history/60/801420cd96e0001b190ac2ff328be91c
package Model;
public class App {
}
.metadata/.plugins/org.eclipse.core.resources/.history/65/3076dd9496e0001b190ac2ff328be91c
module MyFootballApp {}
.metadata/.plugins/org.eclipse.core.resources/.history/66/e0a0ff9aa2e0001b190ac2ff328be91c
package MainApp;
**
* A Java class devising the main app of our application
* @author Admin
* @version 1.01 09/07/2021
*
public class App {
    
    public static void main(String[] args)
    {
        
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/67/a0921468a0e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent a football playe
* in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class FootballPlayer extends Person{
    
    private int number;
    private String position;
    
    
a default constructor for the class
    public FootballPlayer()
    {    this.number = 1;
        this.position = "Guard";
    }
    
    public FootballPlayer(int number, String position)
    {    super();
        this.number = number;
        this.position = position;
    }
    
    @Ove
ide
    public String toString()
    {    return "FootballPlayer : Number=" + number + ", Position=" + position;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/76/c00f0cfb96e0001b190ac2ff328be91c
.metadata/.plugins/org.eclipse.core.resources/.history/76/e021b9369ae0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent a person in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class Person {
    
    private String name;
    private Height height;
    private int weight;
    private String hometown;
    private String highSchool;
    
    
a default constructor for the class
    public Person() {}
    public Person(String name, Height height, int weight, String hometown, String highSchool) {
        super();
        this.name = name;
        this.height = height;
        this.weight = weight;
        this.hometown = hometown;
        this.highSchool = highSchool;
    }
    @Ove
ide
    public String toString() {
        return "Person : name=" + name + ", height=" + height + ", weight=" + weight + ", hometown=" + hometown
                + ", highSchool=" + highSchool;
    }
}
.metadata/.plugins/org.eclipse.core.resources/.history/7a/700cf64abae0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    
a default constructor for the class
    public OffensiveLine()
    {    this.center = new FootballPlayer();
        this.offensiveGuard = new FootballPlayer();
        this.offensiveTackle = new FootballPlayer();
    }
    
    public OffensiveLine(FootballPlayer center, FootballPlayer offensiveGuard, FootballPlayer offensiveTackle) {
        super();
        this.center = center;
        this.offensiveGuard = offensiveGuard;
        this.offensiveTackle = offensiveTackle;
    }
    
    @Ove
ide
    public String toString()
    {    return "OffensiveLine : Center = " + center
                + "\n\n Offensive Guard = " + offensiveGuard
                + "\n\n Offensive Tackle = " + offensiveTackle;
    }
    
    
    /**
     * A method that calculated the average height of all three
     * football player at the offensive line
     * @return
     *
    public int averageHeight()
    {    
collecting the part of the height of players which consists of
        
feet, for later converting them into inches
        int totalHeightInFeet = ( center.getHeight().getFeet()
                + offensiveGuard.getHeight().getFeet()
                + offensiveTackle.getHeight().getFeet() ) ;
        
        
converting height in feet into inches
        int totalHeightInInches = totalHeightInFeet * Height.INCHES_PER_FEET;
        
        
finally adding the part of the height of players which consists of
        
inches to get the overall sum of their heights in inches
        totalHeightInInches += center.getHeight().getInches()
                + offensiveGuard.getHeight().getInches()
                + offensiveTackle.getHeight().getInches() ;
    
        int averageHeightInInches = totalHeightInInches/3;
        
        return averageHeightInInches;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/7d/8050f5e09ee0001b190ac2ff328be91c
.metadata/.plugins/org.eclipse.core.resources/.history/7f/9088623cf2e0001b158eb748a6b26fde
package MainApp.Model;
**
* A Java class used to initialize our model
* @author Admin
* @version 1.01 09/07/2021
*
public class Model {
    public Model()
    {    
creating 3 FootballPlayer objects    
        FootballPlayer footballPlayer1 = new FootballPlayer(5, "Offense", "Wilbur",
                new Height(5,8), 67, "Chicago", "Chicago" );
        
        FootballPlayer footballPlayer2 = new FootballPlayer(8, "Offense", "Samuel",
                new Height(6,0), 75, "Boston", "Boston" );
        
        FootballPlayer footballPlayer3 = new FootballPlayer(3, "Offense", "Jade",
                new Height(5,11), 60, "Seattle", "Seattle" );
        
        
        
creating an OffensiveLine object using the 3 Football Player objects
        OffensiveLine offensiveLine =
                new OffensiveLine(footballPlayer1, footballPlayer2, footballPlayer3);
        
        
printing information about offensive line
        System.out.println(offensiveLine);
        
        
printing the average height of the offensive line
        int averageHeight = offensiveLine.averageHeight();
        final int INCHES_PER_FEET = 12;
        System.out.println("Average height of offensive line : "
                + averageHeight / INCHES_PER_FEET + "' "
                + averageHeight % INCHES_PER_FEET + "\"" );
        
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/80/c0ead1a096e0001b190ac2ff328be91c
module MyFootballApp {
}
.metadata/.plugins/org.eclipse.core.resources/.history/86/0096a5a8a2e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to initialize our model
* @author Admin
* @version 1.01 09/07/2021
*
public class Model {
    public Model()
    {    
creating 3 FootballPlayer objects    
        FootballPlayer footballPlayer1 = new FootballPlayer(5, "Offense", "Wilbur",
                new Height(5,8), 67, "Chicago", "Chicago" );
        
        FootballPlayer footballPlayer2 = new FootballPlayer(8, "Offense", "Samuel",
                new Height(6,0), 75, "Boston", "Boston" );
        
        FootballPlayer footballPlayer3 = new FootballPlayer(3, "Offense", "Jade",
                new Height(5,11), 60, "Seattle", "Seattle" );
        
        
        
creating an OffensiveLine object using the 3 Football Player objects
        OffensiveLine offensiveLine =
                new OffensiveLine(footballPlayer1, footballPlayer2, footballPlayer3);
        
        
printing information about offensive line
        System.out.println(offensiveLine);
        
        
printing the average height of the offensive line
        int averageHeight = offensiveLine.averageHeight();
        System.out.println("Average height of offensive line : "
                + averageHeight / Height.INCHES_PER_FEET + "' "
                + averageHeight % Height.INCHES_PER_FEET + "\"" );
        
        
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/8a/10c366069ce0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent a person in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class Person {
    
    private String name;
    private Height height;
    private int weight;
    private String hometown;
    private String highSchool;
    
    
a default constructor for the class
    public Person() {}
    public Person(String name, Height height, int weight, String hometown, String highSchool) {
        super();
        this.name = name;
        this.height = height;
        this.weight = weight;
        this.hometown = hometown;
        this.highSchool = highSchool;
    }
    @Ove
ide
    public String toString() {
        return "Person : Name=" + name + ", Height=" + height + ", Weight=" + weight + ", Hometown=" + hometown
                + ", HighSchool=" + highSchool;
    }
}
.metadata/.plugins/org.eclipse.core.resources/.history/8
a0b37c109ce0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    @Ove
ide
    public String toString() {
        return "OffensiveLine : Center = " + center
                + "\n Offensive Guard = " + offensiveGuard
                + "\n Offensive Tackle = " + offensiveTackle;
    }
    
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/8c
041affba3e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent a football playe
* in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class FootballPlayer extends Person{
    
    private int number;
    private String position;
    
    
a default constructor for the class
    public FootballPlayer()
    {    this.number = 1;
        this.position = "Guard";
    }
    
    public FootballPlayer(int number, String position, String name,
            Height height, int weight, String hometown, String highSchool)
    {    super(name, height, weight, hometown, highSchool);
        this.number = number;
        this.position = position;
    }
    
    @Ove
ide
    public String toString()
    {    return "FootballPlayer : Number=" + number + ", Position=" + position;
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/96/20367b1ef6e0001b158eb748a6b26fde
package MainApp.Model;
**
* A Java class used to represent a football playe
* in our application model
* @author Admin
* @version 1.01 09/07/2021
*
public class FootballPlayer extends Person{
    
    private int number;
    private String position;
    
    
a default constructor for the class
    public FootballPlayer()
    {    this.number = 1;
        this.position = "Guard";
    }
    
    public FootballPlayer(int number, String position, String name,
            Height height, int weight, String hometown, String highSchool)
    {    super(name, height, weight, hometown, highSchool);
        this.number = number;
        this.position = position;
    }
    
    @Ove
ide
    public String toString()
    {    return "[ FootballPlayer : " + super.toString() +
            " Number=" + number + ", Position=" + position + " ]";
    }
    
}
.metadata/.plugins/org.eclipse.core.resources/.history/9c/4090bf709ae0001b190ac2ff328be91c
package MainApp.Model;
public class OffensiveLine {
}
.metadata/.plugins/org.eclipse.core.resources/.history/9d/e0f21f3ba4e0001b190ac2ff328be91c
package MainApp.Model;
**
* A Java class used to represent an offensive line
* of a football game
* @author Admin
* @version 1.01 09/07/2021
*
public class OffensiveLine {
    private FootballPlayer center;
    private FootballPlayer offensiveGuard;
    private FootballPlayer offensiveTackle;
    
    
a default constructor for the class
    public OffensiveLine()
    {    this.center = new FootballPlayer();
        this.offensiveGuard = new FootballPlayer();
        this.offensiveTackle = new FootballPlayer();
    }
    
    public OffensiveLine(FootballPlayer center, FootballPlayer offensiveGuard, FootballPlayer offensiveTackle) {
        super();
        this.center = center;
        this.offensiveGuard = offensiveGuard;
        this.offensiveTackle = offensiveTackle;
    }
    
    @Ove
ide
    public String toString()
    {    return "OffensiveLine : Center = [ " + center + " ]"
                + "\n Offensive Guard = [ " + offensiveGuard + " ]"
                + "\n Offensive Tackle = [ " + offensiveTackle + " ]";
    }
    
    
    /**
     * A method that calculated the average height of all three
     * football player at the offensive line
     * @return
     *
    public int averageHeight()
    {    
collecting the part of the height of players which consists of
        
feet, for later converting them into inches
        int totalHeightInFeet = ( center.getHeight().getFeet()
                +...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here