Reference no: EM132164406
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 A's first cat fight B's first cat, then they make A's second cat fight B's second cat, then they make A's third cat fight B's third cat.
Whoever's cats win most times (it can't 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.