Skip to main content

Practice · 3 of 3

FRQ (c): average for a day

CHALLENGE
Difficulty: advanced+25 XP

Part (c): parallel arrays days[i] names the day of temps[i]. Implement averageForDay(String[] days, double[] temps, String day) returning the **average temperature for the given day**, or 0.0 when the day never appears. Example: days {Mon, Tue, Mon}, temps {10.0, 20.0, 30.0}, day "Mon" → 20.0.

Back to lesson: Practice: FRQ workshop: the weather station