Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Thrower Ant is a powerful threat to the bees, but it has a high food cost. In this problem, you'll implement two subclasses

 

A Thrower Ant is a powerful threat to the bees, but it has a high food cost. In this problem, you'll implement two subclasses of Thrower Ant that are less costly but have constraints on the distance they can throw: The LongThrower can only throw_at a Bee that is found after following at least 5 entrance transitions. It cannot hit Bees that are in the same Place as it or the first 4 Place s in front of it. If there are two Bee s, one too close to the LongThrower and the other within its range, the LongThrower should only throw at the farther Bee, which is within its range, instead of trying to hit the closer Bee. The ShortThrower can only throw_at a Bee that is found after following at most 3 entrance transitions. It cannot throw at any bees further than 3 Places in front of it. Neither of these specialized throwers can throw_at a Bee that is exactly 4 Place s away. Class Short Thrower Long Thrower Food Cost Initial Health 2 2 1 1 To implement these new throwing ants, your ShortThrower and LongThrower classes should inherit the nearest_bee method from the base Thrower Ant class. The logic of choosing which bee a thrower ant will attack is the same, except the ShortThrower and Long Thrower ants where their range is limited by a lower and upper bound, respectively. To do this, modify the nearest_bee method to reference lower_bound and upper_bound attributes, and only return a bee if it is within range. Make sure to give these lower_bound and upper_bound attributes appropriate values the Thrower Ant class so that the behavior of Thrower Ant is unchanged. Then, implement the subclasses LongThrower and ShortThrower with appropriately constrained ranges. You should not need to repeat any code between Thrower Ant, ShortThrower, and LongThrower. float('inf') returns an infinite positive value represented as a float that can be compared with other numbers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The skin friction coefficient Cf for a laminar boundary ... 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

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

1292016922, 978-1292016924

More Books

Students also viewed these Programming questions

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago