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 Practice

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 creating classes

you will create the FootballPlayer and the Height classes

Practice on using information hiding

FootballPlayer and Height will have private attributes and provide get/set methods

Learn how to create more complex classes

the FootballPlayer class uses another class, Height as one of its attributes

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

Start with this NetBeans project or create one with

App.java

Model

Model.java

FootballPlayer.java

Height.java

Functionality

The application App creates a Model object

The Model class

creates 2 FootballPlayer objects

compares the height of the two FootballPlayer objects

displays a message stating who is the tallest

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 two football players and compare their heights and displays a message stating that one is taller than the other or if they are of the same height

For instance,

John Doe with 6'2" is taller than Nick Smith with 5'9"

Nick Smith with 5'4" is taller than John Doe with 5'1"

John Doe with 6'2" has the same height as Nick Smith with 6'2"

make sure you test for all the possible cases

player 1 is taller than player 2

player 2 is taller than player 1

both have the same height

FootballPlayerhas the following attributes

int number;

String name;

String position;

Height height;

int weight;

String hometown;

String highSchool;

Height

it is a class (or type) which is used in FootballPlayer defining the type of the attribute height

it has two attributes

int feet;

int inches

it also has a method that returns a formatted string with feet and inches

for instance: 5'2"

app Creates a Model object FootbalIPlayer int number String name String position Model Height int feet int inches Creates two FootballPlayer objects Compare their heights .Height height int weight .Display a message stating who is the tallest . String hometown .String highSchool

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!