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 Chuckles is an 8 kg spaniel who isn\'t a show dog. Jill, his owner, is a little nutty. She decides to change her name to \"Darth\" and Chuckles\' name to \"Lancelot\". Write statements that accomplish 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);
Solution
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
 package chegg;
public class Dog {
   
 private double weight;
 private boolean show;
 private String breed;
 private String name;
   
 public Dog()
 {
 weight = 0.0;
 show = false;
 breed = \"\";
 name = \"\";
 }
   
 public Dog(String name,String breed,double weight,boolean show)
 {
 this.weight = weight;
 this.breed = breed;
 this.show = show;
 this.name = name;
 }
   
 public void setWeight(double weight)
 {
 this.weight = weight;
 }
   
 public void setName(String name)
 {
 this.name = name;
 }
   
 public void setShow(boolean show)
 {
 this.show = show;
 }
   
 public void setBreed(String breed)
 {
 this.breed = breed;
 }
   
   
 }
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
 package chegg;
 public class DogOwner {
 private String name;
 private Dog d;
   
 public DogOwner()
 {
 name = \"\";
 d = new Dog();
 }
   
 public DogOwner(String name,Dog d)
 {
 this.name = name;
 this.d = d;
 }
   
 public Dog getDog()
 {
 return d;
 }
   
 public void setDog(Dog d)
 {
 this.d = d;
 }
   
 public void setName(String name)
 {
 this.name = name;
 }
   
 }
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
 package chegg;
 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\");
 }
 }



