subject

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

Overriding methods

toString( ) (Links to an external site.)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 the How 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 receives all the attributes as parameters and update the attributes accordingly

Follow Horstmann's Java Language Coding GuidelinesLinks to an external site.

Organized in packages (MVC - Model - View Controller)

Contents

Person int number app Creates a Model object * String name Height * String position Height height int feet int inches int weight Model . String hometown . String highSchool .String toString( ) Creates three FootballPlayer objects Creates an OffensiveLine object using the three FootballPlayer objects Displays OffensiveLine information Displays OffensiveLine average weight . String toString() extends FootballPlayer * String position . String toString() int number OffensiveLine .FootballPlayer center .FootballPlayer offensiveGuard .FootballPlayer offensiveTackle . String toString()

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 3 FootballPlayer objects

displays information about the OffensiveLine object and its 3 players

it is a requirement that this should be done using the toString( ) method in OffensiveLine, which will use toString( ) in FootballPlayer

displays the average weight of the OffensiveLine

this will be done using the averageWeight in the OffensiveLine

The classes

App

it has the main method 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 weight of the OffensiveLine

this has to be done using the OffensiveLine object

this has to call the averageWeight method in OffensiveLine

Personhas the following attributes

String name;

Height height;

int weight;

String hometown;

String highSchool;

and a method

String toString( )

toString( ) overrides the superclass Object toString( ) method

toString( ) returns information about this class attributes as a String

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 here.

FootballPlayerhas the following attributes

int number;

String position;

and a method

String toString( )

toString( ) overrides 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 attribute height

it has two attributes

int feet;

int inches

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"

OffensiveLinehas the following attributes

FootballPlayer center;

FootballPlayer offensiveGuard;

FootballPlayer offensiveTackle;

They might also be stored in an ArrayList

and two methodsString toString( )

toString( ) overrides the superclass Object toString( ) method

toString( ) returns information about the 3 players attributes as a String

int averageWeight()

calculates and returns the average weigh of the OffensiveLine.

it is calculated based on the weight of each of its players

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:00
Much has been made of the new web 2.0 phenomenon, including social networking sites and user-created mash-ups. how does web 2.0 change security for the internet? how do secure software development concepts support protecting applications?
Answers: 1
question
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
Which parts of a presentation should be the most general? a. introduction and conclusion b. introduction and outline c. outline and conclusion d. outline and body
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
You know the right answer?
Do not use the scanner class or any other user input request. You application should be self-contain...
Questions
question
Biology, 30.09.2019 09:00
question
Mathematics, 30.09.2019 09:10
Questions on the website: 13722360