A Thrower Ant is a powerful threat to the bees, but it has a high food...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
1. Arrays - Create a program that asks for 10 integers. Display a navigation menu and perform the following: A. Display the numbers. B. Display the values of even indexes (0th, 2nd, 4th, 6th, etc.)...
-
Some people rely heavily on social networking, instant messaging, and texting to communicate with friends and business colleagues. Others find these methods distracting. Do you use social networking,...
-
For each of the following requirements, identify the best choice of degree of durability in a remote backup system: a. Data loss must be avoided but some loss of availability may be tolerated. b....
-
Prepare a balance sheet and a common sized balance sheet for Siam Cement Group (SCG), based in Thailand, from the following information (in Thai baht). Cash Accounts Receivable. Accounts Payable...
-
On January 1, 2016, Teacher Credit Union (TCU) issued 8%, 20-year bonds payable with face value of $400,000. The bonds pay interest on June 30 and December 31. Requirements 1. If the market interest...
-
31 The number of protons, electrons and neutrons in aluminium ion Al+ is Protons A. 27 B. 13 C. ABCD 32 32. D. 13 10 Electron 27 neutrons 14 14 14 10 14 17 14 The formula of the compound formed...
-
Cullumber Warehouse distributes hardback books to retail stores and extends credit terms of 4/10, n/30 to all of its customers. During the month of June, the following merchandising transactions...
-
A spherical portion has been removed from a solid sphere having a charge distributed uniformly in its volume as shown in the figure. The electric field inside the emptied space is (A) zero everywhere...
-
Encourage students to share examples of their own paperless (or paper-bound) communication styles. How has paper use been encouraged or discouraged in the organizations and companies where they have...
-
Deep Seas Submarine must implement a new engine in its submarines to meet the needs of clients who desire quieter operation. Two designs, both technologically feasible, have been created, and Deep...
-
Are there any topics on which you are already a Level 2 expert (i.e., someone who has deep knowledge about a topic)? How did you gain that expertise? What research sources or approaches would you...
-
Which of the notes regarding the Elmer Fund is correct? A. Only Note 4 B. Only Note 5 C. Both Note 4 and Note 5 Three years ago, the Albright Investment Management Company (Albright) added four new...
-
Bailey, Inc., is considering buying a new gang punch that would allow them to produce circuit boards more efficiently. The punch has a first cost of \($100\),000 and a useful life of 15 years. At the...
-
Fact: At least one optimal solution -if an optimal solution exists- of a linear program has to be an extreme point (vertex, corner point). The below figure shows the graphical model of a linear...
-
The time to assemble the first unit on a production line is 10 hours. The learning rate is 0.94. Approximately how long will it take for the seventh unit to be assembled? The number of hours needed...
-
Go to the library and search out print media (i.e., magazine and newspaper) advertising by a company, or one of its products or brands in different countries. Does this company use standardized or...
-
There are many who believe that whatever is legal is ethical. Do you agree with this belief as it might apply to the international marketer? Explain your position and give examples of behaviour in...
-
Mrs Kubo is the mother of an autistic child who fortunately was diagnosed when still very young. In order to help him develop word skills when he was still a small baby, Mrs Kubo started cutting out...
-
The proof of Theorem 19.29 uses, implicitly, the following beautiful result due to Skorokhod [239] which is to be proved: Lemma. Let \(b:[0, \infty) ightarrow \mathbb{R}\) be a continuous function...
-
We have seen in Lemma 19.27.a) that \(\operatorname{supp}\left[d L_{t}^{0}(\omega) ight] \subset\left\{t \geqslant 0: B_{t}(\omega)=0 ight\}\) for almost all \(\omega\). Show that...
-
Show that in Lemma 19.32.a) the following stronger assertion holds: \(\left(L_{t} ight)_{t \geqslant 0}\) is an additive functional, i.e. \(L_{t+s}=L_{t}+L_{s} \circ \theta_{t}\) holds for all \(s,...
Study smarter with the SolutionInn App