The files at the links below contain source code for three i

The files at the links below contain source code for three interrelated classes, a Dog class, a DogOwner class, and a DogTester class that manipulates objects from the other two classes. DogTester.java DogOwner.java Dog.java Darth (formerly Jill) decides to change her dog Lancelot into a show dog. Write a statement that accomplishes this in the main method in the DogTester class: public class DogTester { public static void main (String[] arg) { DogOwner jill; Dog d = new Dog(\"Hotdog\", \"poodle\", 15.0, true); jill = new DogOwner(\"Jill\", d); Dog c = new Dog(\"Chuckles\", \"spaniel\", 8.0, false); jill.setDog(c); jill.setName(\"Darth\"); jill.getDog().setName(\"Lancelot\");

Solution

public class DogTester {
   public static void main (String[] arg) {
       DogOwner jill;
       Dog d = new Dog(\"Hotdog\", \"poodle\", 15.0, true);
       jill = new DogOwner(\"Jill\", d);
       Dog c = new Dog(\"Chuckles\", \"spaniel\", 8.0, false);
       jill.setDog(c);
       jill.setName(\"Darth\");
       jill.getDog().setName(\"Lancelot\");

       // statement to change show dog
       // sice you have not posted Dog and DogOwner class, so I do not know function name
       // but you can replace setXXX with exact function name that is available in Dog class
       jill.getDog().setXXX(\"show\");
   }
}

The files at the links below contain source code for three interrelated classes, a Dog class, a DogOwner class, and a DogTester class that manipulates objects f

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site