Question #50418

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

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

Expert's answer

## Comments

## Leave a comment