Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. public class Human {
  2.  
  3. //ATTRIBUTES
  4. int height = 0;
  5. int age = 0;
  6. int numberOfArms = 0;
  7.  
  8. String firstName = "";
  9. String lastName = "";
  10.  
  11. boolean workingPancreas = true;
  12. boolean workingLungs = true;
  13.  
  14. double runningSpeed = 0.0;
  15.  
  16. //CONSTRUCTORS
  17. public Human() {
  18.  
  19. }
  20.  
  21. public Human(String firstName, String lastName) {
  22. this.firstName = firstName;
  23. this.lastName = lastName;
  24. }
  25.  
  26. //ACCESSORS
  27. public void setFirstName(String firstName) {
  28. this.firstName = firstName;
  29. }
  30.  
  31. public String getFirstName() {
  32. return firstName;
  33. }
  34.  
  35. public void setWorkingPancreas(boolean workingPancreas) {
  36. this.workingPancreas = workingPancreas;
  37. }
  38.  
  39. public boolean getWorkingPancreas() {
  40. return workingPancreas;
  41. }
  42.  
  43. public void setRunningSpeed(double runningSpeed) {
  44. this.runningSpeed = runningSpeed;
  45. }
  46.  
  47. public double getRunningSpeed() {
  48. return runningSpeed;
  49. }
  50.  
  51. //BEHAVIORS
  52. public void printName() {
  53. System.out.println("My name is " + firstName + " " + lastName+".");
  54. }
  55.  
  56. public void printPancreaticStatus() {
  57. if(workingPancreas == true) {
  58. System.out.println("All pancreatic systems are functional");
  59. } else {
  60. System.out.println("RUT ROW! Something went wrong!");
  61. }
  62. }
  63.  
  64. public void increaseRunningSpeed() {
  65. runningSpeed += 1;
  66. }
  67.  
  68. public void printRunningSpeed() {
  69. System.out.println("The current running speed is "+runningSpeed+" mph");
  70. }
  71.  
  72. public boolean isRunning() {
  73. if(runningSpeed >= 4.0) {
  74. return true;
  75. }
  76.  
  77. return false;
  78. }
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement