For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab13B. Dog objects have a few attributes, but this time unlike chair objects they can also do some cool things too. 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 Lab13B once I have created 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 o bark o rename o eat //prints "Woof! Woof!" //take a string and change the name of the dog //take a double and add that number to weight 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

language is c++ 

sample output included with user input in bold 

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: Patches
What color is the dog: chocolate
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.
```

### Explanation:

This excerpt provides a sample output for a program that manages details about a dog object, including its age, weight, name, color, and breed. Initially, the object's name is "Patches," but it's later changed to "Sparky." The output also demonstrates how the dog's weight increases after eating.
Transcribed Image Text: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: Patches What color is the dog: chocolate 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. ``` ### Explanation: This excerpt provides a sample output for a program that manages details about a dog object, including its age, weight, name, color, and breed. Initially, the object's name is "Patches," but it's later changed to "Sparky." The output also demonstrates how the dog's weight increases after eating.
**Lab13B: My dog can do tricks**

In this lab, we will create two classes: one called `Dog` and another called `Lab13B`. Dog objects have several attributes and, unlike chair objects, can perform actions—each action is represented by a method. For instance, if you want a Dog to bark, you can create a method for this behavior in the `Dog` class and call it from the driver `Lab13B` once the object is created.

**Dog Class:**

- **Variables (Attributes):** Make these public, like in the first exercise:
  - `int age` // current age of the dog
  - `double weight` // weight in pounds
  - `String/string name` // name of the dog
  - `String/string furColor` // fur/hair color of the dog
  - `String/string breed` // breed of the dog

- **Behaviors (Methods):** These should also be public:
  - `bark` // prints "Woof! Woof!"
  - `rename` // takes a string and changes the dog's name
  - `eat` // takes a double and adds it to the dog's weight

Remember to define a return data type for each method and specify the parameters needed for their functionality.

**Driver Class:**

This class includes the main method. Within this method, create a new Dog object and prompt the user to input the Dog’s attributes. After the input, print all the Dog’s details.

Next, use the methods created in the Dog class to make it bark, rename it (using the rename method, not the dot operator), and feed it.
Transcribed Image Text:**Lab13B: My dog can do tricks** In this lab, we will create two classes: one called `Dog` and another called `Lab13B`. Dog objects have several attributes and, unlike chair objects, can perform actions—each action is represented by a method. For instance, if you want a Dog to bark, you can create a method for this behavior in the `Dog` class and call it from the driver `Lab13B` once the object is created. **Dog Class:** - **Variables (Attributes):** Make these public, like in the first exercise: - `int age` // current age of the dog - `double weight` // weight in pounds - `String/string name` // name of the dog - `String/string furColor` // fur/hair color of the dog - `String/string breed` // breed of the dog - **Behaviors (Methods):** These should also be public: - `bark` // prints "Woof! Woof!" - `rename` // takes a string and changes the dog's name - `eat` // takes a double and adds it to the dog's weight Remember to define a return data type for each method and specify the parameters needed for their functionality. **Driver Class:** This class includes the main method. Within this method, create a new Dog object and prompt the user to input the Dog’s attributes. After the input, print all the Dog’s details. Next, use the methods created in the Dog class to make it bark, rename it (using the rename method, not the dot operator), and feed it.
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education