Question: 1. Write a class called Dog that contains instance data that represents the dogs name as a String and weight in pounds, as a double.

1. Write a class called Dog that contains instance data that represents the dogs name as a String and weight in pounds, as a double. In addition, the class should have the following methods: A default constructor, which initializes name to dog and weight to 0 A getter for each instance data A setter for each instance data A method toKgs() that computes and returns the weight of the dog in kilograms (1lb = 0.453592 kg). A toString() method that returns a one-line description of the dog including name and weight. 2. Write an application Kennel that instantiates two Dog objects and updates the names and weights with data from the user. The program will display the information about each object (Hint: toString() method) as well as the average weight in kilograms.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!