Problem

Complete the following tasks:a. Design a Dog class that includes fields for a breed (for e...

Complete the following tasks:

a. Design a Dog class that includes fields for a breed (for example, “Labrador”) and eye color. Include extraction and insertion operators.


b. Overload an operator*()function for the Dog class. When you multiply two Dogs, the result is a Dog. If the two operand Dogs are the same breed, then the resulting Dog is that breed; if the two operand Dogs have different breeds, then the resulting Dog is “Mixed” breed. Obtain a random number of 0 or 1 for the resulting Dog’s eye color. When the random number chosen is 0, use the eye color from the first operand Dog for the resulting Dog’s eye color; when the random number is 1, use the eye color of the second Dog for the result Dog.


c. Write a main()function in which you declare four parent Dogs. When you execute the program, make sure you assign the same breed to two Dogs, and different breeds to each of the other two Dogs. (You will have a total of three breeds for the four Dogs.) Also assign a variety of eye colors. In a loop, multiply each pair eight times, and display the results. Save the file as Dog.cpp.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT