As an elephant trainer you are taking part in a international elephant exhibition. During the event...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
As an elephant trainer you are taking part in a international elephant exhibition. During the event elephants from different teams enter and exit the show room - where elephant experts can inspect and score them. Elephants do not enter the show room all at once, as that would cause too much commotion. The organizers of the event are letting them in and out based on a predefined schedule. Before the show starts you get access to the schedule for your elephants - but not for the others. Nevertheless, during the show, you can observe all elephants getting in and out of the room. Based on your experience, you believe that judges tend to award the biggest elephants in the room with the highest scores. Before the final results are out, you want to estimate your chances of winning this competition. Problem Statement Complete the following functions in the editor below: • The ElephantCompetition class constructor that accepts elephant descriptions and the private schedule of when the elephants enter and exit the show room. • The elephantEntered and elephantLeft functions that are called whenever a new elephant enters or leaves the room. • The getBiggestElephants function that, for the current time, returns a list of our elephants in the room that are at least as big as the biggest elephant from competing teams in the room. The presented list has to be sorted alphabetically. Function Definitions The ElephantCompetition class constructor has the following parameters: elephants: a list of elephant descriptions each of which contains a name (a string) and a height (an integer) schedule: a list of elephant schedules each of which contains a name (a string), an enter time (an integer) and an exit time (an integer) - the enter and exit times are in minutes since the start of the show The elephantEntered function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height. an integer describing the height of the elephant that entered the room The elephantLeft function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that left the room Function Definitions The ElephantCompetition class constructor has the following parameters: elephants: a list of elephant descriptions each of which contains a name (a string) and a height (an integer) schedule: a list of elephant schedules each of which contains a name (a string), an enter time (an integer) and an exit time (an integer) - the enter and exit times are in minutes since the start of the show The elephantEntered function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that entered the room The elephantLeft function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that left the room The getBiggestElephants function has no parameters. Constraints ● Elephant names are unique • The schedule is strictly followed - your elephants enter and exit the room exactly at the specified times • Times (e.g., currentTime and the elephant enter and exit times) are always whole numbers and multiple events can occur at the same time • The elephantEntered and elephantLeft are called in order of currentTime • Each elephant enters the room only once during the show • When the getBiggestElephants function is called at time teither o all the elephants that are scheduled to enter or leave the room at time thave not yet done so; OR o all the elephants that are scheduled to enter or leave the room at time thave done so. As an elephant trainer you are taking part in a international elephant exhibition. During the event elephants from different teams enter and exit the show room - where elephant experts can inspect and score them. Elephants do not enter the show room all at once, as that would cause too much commotion. The organizers of the event are letting them in and out based on a predefined schedule. Before the show starts you get access to the schedule for your elephants - but not for the others. Nevertheless, during the show, you can observe all elephants getting in and out of the room. Based on your experience, you believe that judges tend to award the biggest elephants in the room with the highest scores. Before the final results are out, you want to estimate your chances of winning this competition. Problem Statement Complete the following functions in the editor below: • The ElephantCompetition class constructor that accepts elephant descriptions and the private schedule of when the elephants enter and exit the show room. • The elephantEntered and elephantLeft functions that are called whenever a new elephant enters or leaves the room. • The getBiggestElephants function that, for the current time, returns a list of our elephants in the room that are at least as big as the biggest elephant from competing teams in the room. The presented list has to be sorted alphabetically. Function Definitions The ElephantCompetition class constructor has the following parameters: elephants: a list of elephant descriptions each of which contains a name (a string) and a height (an integer) schedule: a list of elephant schedules each of which contains a name (a string), an enter time (an integer) and an exit time (an integer) - the enter and exit times are in minutes since the start of the show The elephantEntered function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height. an integer describing the height of the elephant that entered the room The elephantLeft function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that left the room Function Definitions The ElephantCompetition class constructor has the following parameters: elephants: a list of elephant descriptions each of which contains a name (a string) and a height (an integer) schedule: a list of elephant schedules each of which contains a name (a string), an enter time (an integer) and an exit time (an integer) - the enter and exit times are in minutes since the start of the show The elephantEntered function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that entered the room The elephantLeft function has the following parameters: currentTime: an integer which is the number of minutes since the start of the show height: an integer describing the height of the elephant that left the room The getBiggestElephants function has no parameters. Constraints ● Elephant names are unique • The schedule is strictly followed - your elephants enter and exit the room exactly at the specified times • Times (e.g., currentTime and the elephant enter and exit times) are always whole numbers and multiple events can occur at the same time • The elephantEntered and elephantLeft are called in order of currentTime • Each elephant enters the room only once during the show • When the getBiggestElephants function is called at time teither o all the elephants that are scheduled to enter or leave the room at time thave not yet done so; OR o all the elephants that are scheduled to enter or leave the room at time thave done so.
Expert Answer:
Answer rating: 100% (QA)
Steps Step 1 of 1 Heres the complete implementation of the ElephantCompetition class with the constructor elephantEntered elephantLeft and getBiggestElephants functions filled out This implementation ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these human resource management questions
-
You are given the following information on the macroeconomy: Consumption: 300 + 0.75Y Investment: 200 + 0.10Y Government Spending 500 Exports 100 Imports 50 + 0.25Y Compute the equilibrium level of...
-
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...
-
What is the purpose of a cover letter? What questions about you should a good cover letter be able to answer for a potential employer? In what ways could you tailor a cover letter to the position you...
-
Suppose that the magnetic field in some region has the form B = kzx (where k is a constant). Find the force on a square loop (side a), lying in the yz plane and centered at the origin, if it carries...
-
Suppose that the density of seawater, p = p (z), varies with the depth below the surface. (a) Show that the hydrostatic pressure is governed by the differential equation where is the acceleration due...
-
Adina is planning on investing into REIT that will pay her guaranteed cash flows of $120,000 in 10 years. If the appropriate discount rate is $.4 percent compounded daily, what is the present value...
-
A major department store chain is having a sale on refrigerators. The number of refrigerators sold during this sale at a sample of ten stores was: $\begin{array}{llllllllll}80 & 110 & 0 & 40 & 70 &...
-
Which of the many purposes of the project portfolio process are most important to a firm with a low project management maturity? Which to a firm with high maturity?
-
The monthly income of investor is $9,000 per month, and up to 30% of the family income can be used to pay back a mortgage loan . His bank offers him a 30-year mortgage loan with a 2.5% interest rate....
-
For this activity, you'll research potential libraries or modules to use that are compatible with PythonAnywhere to help you script using the data required. Step 1: Find Compatible Libraries A client...
-
Barlow works for Meditron Incorporated and he is a member of the group insurance plan. Barlow was recently injured and is unable to work. He is receiving long-term disability benefits from the group...
-
Determine if the following scenarios are describing savings or investment. If they describe investment, which type of investment? Explain. a. Amazon purchases $100 million worth of products from a...
-
How can sports marketers assess the external environment? What are some sources of secondary data that may assist in understanding the current and future external environment?
-
Differentiate between macro- and microeconomic elements. Which (macro- or microelements) do you feel plays an important role in sports marketing? Why?
-
Of the various behavioural insights explored which do you think have the most power to revolutionize our understanding of how macroeconomies work?
-
Explain each of the five situational factors that influence the participant decision- making process.
-
Explain the evaluation techniques of Self Emulsifying Drug Delivery System.
-
Pedro Bourbone is the founder and owner of a highly successful small business and, over the past several years, has accumulated a significant amount of personal wealth. His portfolio of stocks and...
-
Tom has a successful business with $100,000 of income in 2012. He purchases one new asset in 2012, a new machine which is 7-year MACRS property and costs $25,000. If you are Tom's tax advisor, how...
-
In the 2012 tax year, Michelle paid the following amounts relating to her 2010 tax return: Tax deficiency..........................................$5,000 Negligence...
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
A typical timber wolf has a mass of \(40 \mathrm{~kg}\), a typical jackrabbit a mass of \(2.5 \mathrm{~kg}\). Given the scaling law presented in the passage, we'd expect the specific metabolic rate...
-
A standard gold bar stored at Fort Knox, Kentucky, is 7.00 inches long, 3.63 inches wide, and 1.75 inches tall. Gold has a density of \(19,300 \mathrm{~kg} / \mathrm{m}^{3}\). What is the mass of...
-
A typical timber wolf has a mass of \(40 \mathrm{~kg}\), a typical jackrabbit a mass of \(2.5 \mathrm{~kg}\). Given the scaling law presented in the passage, we'd expect the wolf to use times more...
Study smarter with the SolutionInn App