Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

dd a new menu option 8 called Farm aggressiveness statistics. This option must indicate the number of aggressive animals on the farm, and the average

dd a new menu option 8 called "Farm aggressiveness statistics". This option must indicate the number of aggressive animals on the farm, and the average aggressiveness in agro units. The output should look like this:
There are 3 aggressive animals on the farm.
The average aggressiveness level is 47.6667 aggro units.
All velociraptors are aggressive, and the aggro factor is entered by the user.
All chickens are aggressive as well, though the aggro factor for a chicken is only 1.0.
Cows are not aggressive at all, so they are not counted as aggressive animals on the farm.
Chickens are aggressive?
Hint: There are a couple of ways to solve this. The easiest is to just add some simple virtual function to Animal.
Do not add an isAggressive member variable to any class! There is no need for it and it is redundant to do so. Redundancy is bad! You know the answer to that question for each of the three animals.
Do not add a count member variable to Farm to keep track of the number of aggressive animals or an aggro unit sum value. This is a bad practice, since it requires you to keep these values up to date as the data changes. Again, this is redundancy, and redundancy is very bad.
Can I add a getter for mInventory so I can access it from main?
How do I compute the average aggro factor?
The #1 question for this problem is: Do you understand how DisplayInventory worked? If you just pasted that code in and didn't learn what it is doing, you are going to have problems in this course. The structure for the solution to this problem and the whole problem solving approach in general is almost identical. In particular, you need to understand why we say (over and over again):

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

2. What coping strategies or defences did you use?

Answered: 1 week ago