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...



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. (See Appendix E


for instructions on creating random numbers.) 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.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here