Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started