Question: Using C++ Part A. A particular club whose members are interested in cats wants to computerise all their records. For each cat they record its

Using C++

Part A. A particular club whose members are interested in cats wants to computerise all their records. For each cat they record its name and colour (both strings), and its number of legs, weight, and value (all ints).

+ Design a struct or object suitable for representing cats.

+ Provide a set function for initialising a cat object with those five pieces of information, and

+ Provide a suitable print function for displaying the information for a cat nicely.

Part B. It is in fact a club only for very special people who own exactly three cats, no more, no less. Every member has a name, and address, and three cats.

+ Design a struct or object suitable for representing members.

+ Provide a set function for initialising a member object with those five pieces of information, and

+ Provide a suitable print function for displaying the information for a club member nicely.

Part C. For entertainment, the club members sometimes set up fights between their cats (I said they were special people, not nice people). They have discovered a few things:

+ A cat with 4 legs always defeats a cat with some other number of legs.

+ If that does not settle the matter, heavier cats always beat lighter cats.

+ If that leaves the result unresolved, cheaper cats always beat more expensive cats.

+ After that, the winner is just random.

Write a function that takes two cat parameters and determines the outcome of a fight between them. It should return 1 if the first cat parameter wins, and 2 if the second wins.

Part D. The club members also have contests against each other. When member A battles member B, this is how it works. They make As first cat fight Bs first cat, then they make As second cat fight Bs second cat, then they make As third cat fight Bs third cat. Whoevers cats win most times (it cant be a tie because they all have three cats) is the winner. The defeated member has his name officially changed to "Mr. Loser".

Write a function that carries out the battle between two club members.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!