ACSA Exam Prep
Unit 4 · Data Collections · Topic 4.2

Introduction to Using Data Sets

Skill 1.B

Big idea: Working with a data set means visiting its values one at a time and doing something with each. Planning on paper first makes the code easy.

Learning objectives
  • Represent patterns and algorithms that involve data sets found in everyday life using written language or diagrams.

Plan with a table

Before writing code, write a few sample rows and walk through what should happen to each. This is how you discover edge cases, like an empty list or a tie.

DayHigh (°F)Above 80?Running count
Mon78no0
Tue83yes1
Wed85yes2
Thu79no2

The same plan in code

Code
int[] highs = {78, 83, 85, 79};
int hot = 0;
for (int h : highs) {
  if (h > 80) hot++;
}
System.out.println(hot);
Output
2
Key points
  • A data set is a collection of specific pieces of information.
  • Analysis means accessing values one at a time and processing them toward a goal.
  • Charts and tables help plan the algorithm.
Watch out
  • Sketching sample data by hand is the fastest way to find edge cases.
Quick check
What questions could a table of (date, steps walked) answer?
Show answer
For example: the average steps per day, the best day, how many days met a goal, or whether steps increased over time.