Design and implement a class


Design and implement a class called Puppy that contains instance data representing a puppy's breed, color, and weight. Create the Puppy constructor to accept and initialize instance data.

Write appropriate getter and setter methods for the breed, color, and weight. Include a food method to calculate and return the amount of chow the puppy gets at meal time (0.84 oz. times the puppy's weight).

Be sure this method is using the puppy's current weight when calculating the amount of chow. Include a toString method that returns a one-line description of the puppy (breed, color, weight, and ounces of food). 1b. Create a driver class called PetStore, whose main method instantiates six puppy objects (make up breeds, colors, and weights) and prints out who is for sale (print all 6 puppy objects).

Use the setter methods to modify the breed of 2 puppies, the color of 2 different puppies, and the weight of the remaining 2 puppies. Use the getter method in a statement to print the puppies whose breed, color or weight were changed. Then print the PetStore again. Did the amount of food change for the puppies whose weight was changed with the setter method? Be sure to follow the directions and print all puppies, make changes, print changes, then print all puppies.

Request for Solution File

Ask an Expert for Answer!!
Other Subject: Design and implement a class
Reference No:- TGS0107061

Expected delivery within 24 Hours