Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java run through eclipse /** * During a heat wave, any sign of lower temperatures is news. This function takes an * array of

In java run through eclipse

/** * During a heat wave, any sign of lower temperatures is news. This function takes an * array of temperatures and an array of the cities where each temperature reading was * recorded. The function should return the name of a city that experienced a temperature * drop. If no city experienced a drop, the function should return null. * * You can assume only 1 city will experience a drop. * * Use maps to solve this problem. * * Example 1: * * Temps: City: * 80 Seattle * 100 LA * 81 Seattle * 99 LA * * The function should return "LA" because it experienced a drop from 100 to 99. * * Example 2: * * Temps: City: * 91 Terre Haute * 92 Terre Haute * 80 Seattle * 93 Terre Haute * 100 LA * 83 Seattle * 93 Terre Haute * 82 Seattle * 105 LA * 85 Seattle * * The function should return "Seattle" because 83 to 82 was a drop. * * Example 3: * * Temps: City: * 91 Terre Haute * 92 Terre Haute * 80 Seattle * * The function should return null because no city had a drop. * * @param temps temperatures recorded in time order * @param names names of the cities where each temperature was taken * @return city that had a temperature drop */ public static String getTemperatureDropCity(int[] temps, String[] tempCity) { return null; }

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions