Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The files at the links below contain source code for three interrelated classes,

ID: 3922039 • Letter: T

Question

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");

Explanation / Answer

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");
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote