Lab10B: My dog can do tricks For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab10B. Dog objects have a few attributes, but this time unlike chair objects they can also do some cool things to. Each action is represented by a method. Therefore, for any action our Dog can do or we do to the Dog, we are going to create a method. For example, if I want my Dog to bark, I can create a method to do that in the Dog class and call that method in the driver Lab10B once I have create an object. Dog class: Variables (Attributes): - make these public, like the first exercise int age double weight String/string name String/string furColor String/string breed //current age of the dog //how much does it weight in lbs //what is the name of the dog //color of the dog's fur/hair //what breed is the dog Behaviors (Methods): - these also should be public //prints "Woof! Woof !" //take a string and change the name of the dog //take a double and add that number to weight bark rename eat Keep in mind you need to have a return data type for each method and what parameters these take to carry out their function when creating the methods. Driver class: This class will have our typical main method. Inside of this method, create a new Dog object and prompt the user to input the attributes describing this Dog. Once done, print out all the details about the Dog. Next, use the methods you created in the Dog class to have it bark, change the name (using the rename method not the dot operator), and feed it. Finally print out all the details about the Dog, the object should have changed because of your calls to the various methods.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Help me with this on Java. Create 2 different files for Dog and the main method.

Lab10B: My dog can do tricks
For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab10B.
Dog objects have a few attributes, but this time unlike chair objects they can also do some cool things
to. Each action is represented by a method. Therefore, for any action our Dog can do or we do to the
Dog, we are going to create a method. For example, if I want my Dog to bark, I can create a method
to do that in the Dog class and call that method in the driver Lab10B once I have create an object.
Dog class:
Variables (Attributes): - make these public, like the first exercise
int age
double weight
String/string name
String/string
String/string breed
//current age of the dog
//how much does it weight in lbs
//what is the name of the dog
//color of the dog’s fur/hair
//what breed is the dog
EurColor
Behaviors (Methods): - these also should be public
//prints "Woof! Woof!"
//take a string and change the name of the dog
//take a double and add that number to weight
bark
rename
eat
Keep in mind you need to have a return data type for each method and what parameters these take
to carry out their function when creating the methods.
Driver class:
This class will have our typical main method. Inside of this method, create a new Dog object and
prompt the user to input the attributes describing this Dog. Once done, print out all the details about
the Dog.
Next, use the methods you created in the Dog class to have it bark, change the name (using the
rename method not the dot operator), and feed it.
Finally print out all the details about the Dog, the object should have changed because of your calls to
the various methods.
Sample output:
You are about to create a dog.
How old is the dog: 5
How much does the dog weigh: 30.5
What is the dog's name:
What color is the dog: chocolate
Patches
What breed is the dog: lab
Patches is a 5 year old chocolate lab that weighs 30.5 lbs.
Woof! Woof!
Patches is hungry, how much should he eat: 5000.3
Patches isn’t a very good name. What should they be renamed to: Sparky
Sparky is a 5 year old chocolate lab that weighs 5030.8 lbs.
Transcribed Image Text:Lab10B: My dog can do tricks For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab10B. Dog objects have a few attributes, but this time unlike chair objects they can also do some cool things to. Each action is represented by a method. Therefore, for any action our Dog can do or we do to the Dog, we are going to create a method. For example, if I want my Dog to bark, I can create a method to do that in the Dog class and call that method in the driver Lab10B once I have create an object. Dog class: Variables (Attributes): - make these public, like the first exercise int age double weight String/string name String/string String/string breed //current age of the dog //how much does it weight in lbs //what is the name of the dog //color of the dog’s fur/hair //what breed is the dog EurColor Behaviors (Methods): - these also should be public //prints "Woof! Woof!" //take a string and change the name of the dog //take a double and add that number to weight bark rename eat Keep in mind you need to have a return data type for each method and what parameters these take to carry out their function when creating the methods. Driver class: This class will have our typical main method. Inside of this method, create a new Dog object and prompt the user to input the attributes describing this Dog. Once done, print out all the details about the Dog. Next, use the methods you created in the Dog class to have it bark, change the name (using the rename method not the dot operator), and feed it. Finally print out all the details about the Dog, the object should have changed because of your calls to the various methods. Sample output: You are about to create a dog. How old is the dog: 5 How much does the dog weigh: 30.5 What is the dog's name: What color is the dog: chocolate Patches What breed is the dog: lab Patches is a 5 year old chocolate lab that weighs 30.5 lbs. Woof! Woof! Patches is hungry, how much should he eat: 5000.3 Patches isn’t a very good name. What should they be renamed to: Sparky Sparky is a 5 year old chocolate lab that weighs 5030.8 lbs.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,