Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Filename: Height.java
- * Description:Creates Height class and constructors
- * used to define the height attribute in FootballPlayer
- * objects.
- * Author: Gadiel Amilec Rivera Ortiz
- * 01/18/2020
- * Version: 1.0
- */
- package Model;
- public class Height {
- //Atributes
- private int feet;
- private int inches;
- //Constructors
- public Height(int feet, int inches) {
- this.feet = feet;
- this.inches = inches;
- }
- /*
- No-arg contructor with pre-set values
- */
- public Height() {
- feet = 6;
- inches = 11;
- }
- // Converts feets and inches into total height
- int inInches() {
- int totalHeight = (feet * 12) + inches;
- return totalHeight;
- }
- /*
- Provides the information in String
- data type to be displayed
- */
- @Override
- public String toString() {
- return feet + "\"" + inches + "\'";
- }
- //Getters and Setters
- /**
- * Gets feet attribute
- *
- * @return the feet
- */
- public int getFeet() {
- return feet;
- }
- /**
- * Sets feet attribute
- *
- * @param feet the feet to set
- */
- public void setFeet(int feet) {
- this.feet = feet;
- }
- /**
- * Gets inches attributes
- *
- * @return the inches
- */
- public int getInches() {
- return inches;
- }
- /**
- * Sets inches attributes
- *
- * @param inches the inches to set
- */
- public void setInches(int inches) {
- this.inches = inches;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement