Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. /*
  2. * Filename: Height.java
  3. * Description:Creates Height class and constructors
  4. * used to define the height attribute in FootballPlayer
  5. * objects.
  6. * Author: Gadiel Amilec Rivera Ortiz
  7. * 01/18/2020
  8. * Version: 1.0
  9. */
  10. package Model;
  11.  
  12. public class Height {
  13.  
  14. //Atributes
  15. private int feet;
  16. private int inches;
  17.  
  18. //Constructors
  19. public Height(int feet, int inches) {
  20. this.feet = feet;
  21. this.inches = inches;
  22. }
  23.  
  24. /*
  25. No-arg contructor with pre-set values
  26. */
  27. public Height() {
  28. feet = 6;
  29. inches = 11;
  30. }
  31.  
  32. // Converts feets and inches into total height
  33. int inInches() {
  34. int totalHeight = (feet * 12) + inches;
  35.  
  36. return totalHeight;
  37. }
  38.  
  39. /*
  40. Provides the information in String
  41. data type to be displayed
  42. */
  43. @Override
  44. public String toString() {
  45. return feet + "\"" + inches + "\'";
  46. }
  47.  
  48. //Getters and Setters
  49. /**
  50. * Gets feet attribute
  51. *
  52. * @return the feet
  53. */
  54. public int getFeet() {
  55. return feet;
  56. }
  57.  
  58. /**
  59. * Sets feet attribute
  60. *
  61. * @param feet the feet to set
  62. */
  63. public void setFeet(int feet) {
  64. this.feet = feet;
  65. }
  66.  
  67. /**
  68. * Gets inches attributes
  69. *
  70. * @return the inches
  71. */
  72. public int getInches() {
  73. return inches;
  74. }
  75.  
  76. /**
  77. * Sets inches attributes
  78. *
  79. * @param inches the inches to set
  80. */
  81. public void setInches(int inches) {
  82. this.inches = inches;
  83. }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement