The files at the links below contain source code for three interrelated classes,
ID: 3922805 • 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
Hi friend you have not posted Dog.java so, I do not have idea about method name that set dog as show dog:
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");
// TODO: you have not posted DOG class so, do not have idea about method name,
// please replace setXXX method to actual method
jill.getDog().setXXX("ShowDog")
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.