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

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

1 answer below »
  • 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 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 updates 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

L01_Description.png

  • Start withthis NetBeans projectDownload this NetBeans projector create one with
      • App.java
    • Model
      • Model.java
      • FootballPlayer.java
      • Height.java

Functionality

  • The application App creates a Model object
  • The Model class
    • creates three FootballPlayer objects (one of which uses the "empty" constructor)
    • compares the heights of the two FootballPlayer objects (created with the non-empty constructor)
    • displays a message stating who is the tallest

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 (one of which is a "default") and compares their heights and displays a message stating who is taller or if they are of the same height
    • the "default" football player doesn't need to be compared... this is just to test your empty constructor
    • make sure youtestyour application for all the possible cases
  • FootballPlayer
    • has 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 attributeheight
    • 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"

Note: your output should be readable and include the players names and heights. For example "Bartell is taller than Jones. Bartell is 6'9". Jones is 5'11""

Answered Same Day Feb 03, 2022

Solution

Kshitij answered on Feb 03 2022
115 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here