This is the Air Quality Index app in which students need to calculate the percent of different air quality days. (Link to app: Air Quality - Example - App Lab - Code.org
I am struggling to explain this to students. Which previous levels/lessons help pave the ground for this one? I feel like I’ve missed something along the way.
(*I’m an English teacher primarily, but typically I get the swing of things.)
From what I remember it was more of a math problem for my kids. Calculating the percent, and of course sorting through and knowing which totals to use. The coding challenge there was keeping track of all the lists and what they were (for most of my kids).
Walking them through how they would calculate their score on a test, help many of mine. (your score divided by the total possible points)
So in the app: total good days divided by totalDaysWithAQI gets you the good days percent.
I used the math round to have a whole number displayed, but the original app does not do that.
The simple explanation is that this is the multi-list filter pattern, which you can find in Help and Tips. The state dropdown event filters the air qualities into filtered lists that only include entries for the selected state. The button sums up all the filtered entries for each category (i.e. the ones for the selected state) so that you can calculate the percentage for each category by dividing each one by the total days that were recorded (totalDaysWithAQI) to find a percentage. The only thing left for the kids to do is calculate those percentages and display them.
I think it’s mostly an example that will give them familiarity with the pattern they will need to use for the Make.