Advertisement
therrontelford

Cat Test Drive

Mar 7th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1.  
  2. public class CatTestDrive2 {
  3.  
  4.     public static void main(String[] args) {
  5.         Cat x = new Cat();
  6.         Cat y = new Cat(2, "Terrance", "brown", true);
  7.         Cat z = new Cat(12, "Kincain", "orange", true);
  8.        
  9.         // x Cat doesn't have any values yet
  10.         x.setName("Leatle");
  11.         x.setAge(17);
  12.         x.setColor("gray");
  13.        
  14.         System.out.println(y.getColor() + " " +y.getName());
  15.         System.out.println(x.getColor());
  16.         System.out.println(x.getName());
  17.         System.out.println(x.getAge());
  18.         System.out.println("hello, my name is "+z.getName());
  19.         System.out.println("hello, my name is "+ y.getName());
  20.         y.happyBirthday();
  21.         System.out.println(y.getName() +"-- I'm going to eat now");
  22.         y.eat(3);
  23.         y.setIsHappy(false);
  24.         System.out.print(y.getName() +"----- looking at "+z.getName()+"   ");
  25.         y.talk();
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement