Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Human {
- //ATTRIBUTES
- int height = 0;
- int age = 0;
- int numberOfArms = 0;
- String firstName = "";
- String lastName = "";
- boolean workingPancreas = true;
- boolean workingLungs = true;
- double runningSpeed = 0.0;
- //CONSTRUCTORS
- public Human() {
- }
- public Human(String firstName, String lastName) {
- this.firstName = firstName;
- this.lastName = lastName;
- }
- //ACCESSORS
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
- public String getFirstName() {
- return firstName;
- }
- public void setWorkingPancreas(boolean workingPancreas) {
- this.workingPancreas = workingPancreas;
- }
- public boolean getWorkingPancreas() {
- return workingPancreas;
- }
- public void setRunningSpeed(double runningSpeed) {
- this.runningSpeed = runningSpeed;
- }
- public double getRunningSpeed() {
- return runningSpeed;
- }
- //BEHAVIORS
- public void printName() {
- System.out.println("My name is " + firstName + " " + lastName+".");
- }
- public void printPancreaticStatus() {
- if(workingPancreas == true) {
- System.out.println("All pancreatic systems are functional");
- } else {
- System.out.println("RUT ROW! Something went wrong!");
- }
- }
- public void increaseRunningSpeed() {
- runningSpeed += 1;
- }
- public void printRunningSpeed() {
- System.out.println("The current running speed is "+runningSpeed+" mph");
- }
- public boolean isRunning() {
- if(runningSpeed >= 4.0) {
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement