Question: Purpose of the Hare class Fields The arrogance field will store a value between 0 and 1 ( a percentage ) that indicates the degree

Purpose of the Hare class Fields
The arrogance field will store a value between 0 and 1(a percentage) that indicates the degree of arrogance of this Hare. For example, a Hare that is 50% arrogant will nap half of the time, and run half of the time, while a Hare that is 75% arrogant (an arrogance of 0.75) will nap 75% of the time and run only 25% of the time.
Note that most of the fields of the Hare class are those that are inherited from the Racer super class (i.e. name, distanceCoveredInMeters, minSpeedInMetersPerSecond, maxSpeedInMetersPerSecond).
The parameterized constructor initializes the new Hare object.
This constructor should call the parameterized constructor of the super class, and pass the name parameter value to the super class constructor, along with the minimum speed for a Hare (10 meters per second) and the maximum speed for a Hare (15 meters per second) as arguments. This constructor should also initialize the arrogance field with the value of the arrogance parameter.
The run method simulates this racer running for one time interval.
This method will first compute a random percentage (a value between 0 and 1). If that value is less than the arrogance of this Hare then this racer will take a nap instead of running for this time interval. the total distanceCoveredInMeters will not be updated, and a message formatted like the following will be printed.

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!