Functionality The application App creates a Model object The Model class  creates 3 FootballPlayer objects compares the height of the three 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 three football players and compare their heights displays the information for the three players as output displays a message stating who is taller or if they are of the same height Ignore the start-up code comment and please use this requirement. make sure you test your application for all the possible cases run your program at least 4 times, changing the heights slightly so that you can test all possibilities in your if statements. 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 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" the purpose of this method is to return a string value in this format to be displayed to the user Suggestion for improvement and ease of use in height comparisons: Define a new get method:  getHeightInInches() which returns the total height in inches

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

After reading all L01 content pages in Lesson 01: Objects and Classes, you will complete this assignment 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 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 updates the attributes accordingly
  • all the classes are required to have an "empty" constructor that receives no parameters but updates all the attributes as needed
  • Follow Horstmann's Java Language Coding Guidelines
  • Organized in packages (MVC - Model - View - Controller)

Contents

 

  • Start with this NetBeans project or create one with
    • <default package>
      • App.java
    • Model
      • Model.java
      • FootballPlayer.java 
      • Height.java

Functionality

  • The application App creates a Model object
  • The Model class 
    • creates 3 FootballPlayer objects
    • compares the height of the three 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 three football players and compare their heights
    • displays the information for the three players as output
    • displays a message stating who is taller or if they are of the same height
      • Ignore the start-up code comment and please use this requirement.
    • make sure you test your application for all the possible cases
      • run your program at least 4 times, changing the heights slightly so that you can test all possibilities in your if statements.
  • 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 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"
        • the purpose of this method is to return a string value in this format to be displayed to the user
    • Suggestion for improvement and ease of use in height comparisons:
      • Define a new get method:  getHeightInInches() which returns the total height in inches

NOTE: 
Be sure to copy/paste the output results of all of your test runs as a comment block in your App.java source code file.  Supplying evidence of successful and complete testing of your application is always required.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 7 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY