4.2 Data Sets

From CS Awesome 2CC BY-NC-SA 4.0Original page

Java1 class periodNot autograded

Files

README.mdDownload

4.2 Data Sets

This lesson has no coding exercises.

A data set is a collection of specific pieces of information or data. For example, the following table is a data set that keeps track of information about students. Data can be represented in a diagram by using a chart or table. Here it is shown as a spreadsheet table with columns for the first name, last name, email, and GPA. Spreadsheet software like Excel and Google Sheets store data in a table and provide functions to manipulate and calculate with the data.

A spreadsheet

A spreadsheet

Data sets can be manipulated and analyzed to solve a problem or answer a question. Data in a table or chart can be used to plan the algorithm that will be used to manipulate the data. For example, how would you find the average GPA of the students in the table above? You would need to access each GPA value in the table and then add them up and then divide by the number of rows.

When analyzing data sets, values within the set are accessed and utilized one at a time and then processed according to the desired outcome. Loops can be used to access and process each value in a data set. Let’s practice this with pseudocode.

What if your school wants to print out an honor roll of students with a GPA of 3.5 or higher? How would you write an algorithm to do this?

In the next lessons, we will learn about data structures like Java arrays that can be used to store data sets. We will use loops to access and manipulate the data in the arrays.

Check your understanding: Put the following pseudocode algorithm steps for calculating the average GPA of the students in the table above. Make sure some of the steps are indented to be inside the loop. — answer it on CS Awesome: https://runestone.academy/ns/books/published/csawesome2/topic-4-2-data-sets.html#algorithm-avg-gpa

Write pseudocode for an algorithm that prints out the names of students with a GPA of 3.5 or higher given a table of student data where one column is the GPA. Make sure you use repetition (loop) and selection (if) in your algorithm.

Discuss this with your class, or answer it on CS Awesome: https://runestone.academy/ns/books/published/csawesome2/topic-4-2-data-sets.html#honorroll

Summary

  • (AP 4.2.A.1) A data set is a collection of specific pieces of information or data.
  • (AP 4.2.A.2) Data sets can be manipulated and analyzed to solve a problem or answer a question. When analyzing data sets, values within the set are accessed and utilized one at a time and then processed according to the desired outcome.
  • (AP 4.2.A.3) Data can be represented in a diagram by using a chart or table. This visual can be used to plan the algorithm that will be used to manipulate the data.

For teachers

4.2 Data Sets

Students read CSAwesome2's “Data Sets” in CS Room and work through its questions in class or on CS Awesome.

  • Time: 1 class period
  • Tests: none

Goals

  • (AP 4.2.A.1) A data set is a collection of specific pieces of information or data.
  • (AP 4.2.A.2) Data sets can be manipulated and analyzed to solve a problem or answer a question. When analyzing data sets, values within the set are accessed and utilized one at a time and then processed according to the desired outcome.
  • (AP 4.2.A.3) Data can be represented in a diagram by using a chart or table. This visual can be used to plan the algorithm that will be used to manipulate the data.

Before class

In class

  1. Students read README.md. Questions that need CS Awesome's interactive widgets link back to it.

Exercises

None.