Fill in the blanks in the following Human class definition. Include a function called sleep() or make up your own function. Follow the syntax of the Car example. (There are no right or wrong answers in terms of the actual code itself; it is the structure that is important.)
________ ________  {    
  color hairColor;   
  float height;   
  
  ________()  {    
    ________________________   
    ________________________ 
  }    
  ________________________  {    
    ________________________    
    ________________________    
  }    
}
Answer:
class Human {    
  color hairColor;   
  float height;   

  Human() {    
    hairColor = color(0,0,255);
    height = 6;  
  }    

  void sleep() {
    println("I am a human.");
    println("I am sleeping.");
  }

}


»

No comments yet.

Leave a comment