Overview
The new AP CSA labs are released! In addition to the Magpie, Picture and Elevens lab, now there are 4 more labs to help your students put their learning to practice. They can replace or extend the existing labs. Let’s take a look at what they are.

The new labs:
- Make more explicit connections to the real world and its ethical and social implications.
- Provide Student Activity handouts with more detailed steps, prompts, and questions.
- Encourage open-ended activity at the end of the structured lab activities and offer grading rubrics.
Lab 1 — Consumer Review Lab
Have you heard of the Twitter sentiment analysis program? It’s a program that gathers twitter feeds around a keyword and gives you a number rating of how people feel about it. If you are familiar with it, you should easily recognize the concepts covered in this lab.
The Consumer Review lab, in my personal opinion, can be used to replace the Magpie Lab. Different from the Magpie Lab, this one deals with the Strings AND numbers.
The Ultimate Task: Students will generate fake reviews.
Difficulty: ★
Introduce after: Unit 4
Total Class Periods: 6
Skills:
- Work with multiple classes
- String class methods

Activity 1- Introductions (Reviews and Sentiment Value)
Time: 1 class period
Skills:
* Work with methods — parameters, return values
Tasks:
* Using sentimentVal
method, get the sentiment value for at least 3 words.
Examples:sentimentVal(“happily”); //return 2.32
sentimentVal(“terrible”); //return -3.38
sentimentVal(“cold”); //return -0.04
Activity 2 — Sentiment Value and Star Ratings
Time: 1 class period
Skills:
- Sum algorithm
- Be able to parse a sentence by words and clean it up (remove punctuations)
- Work with conditional statements and understand the importance of the order of the conditions
Tasks:
- Get sentiment value for the whole review by writing a method called
totalSentiment
. Read in a txt file with the review and return the total sentiment value which is the sum of thesentimentVals
. - Write a method that would determine a star rating of a review. Use
totalSentiment
to get the sum of thesentimentVals
Example:
totalSentimentVal(“26WestReview.txt”) //return 29.05
starRating(“26WestReview.txt”) //return 4
totalSentimentVal(“SimpleReview.txt”) //return -2.92
starRating(“SimpleReview.txt”) //return 1
Activity 3 — Autogenerated Review
Time: 1 class period
Skills:
- Work with String class methods
- Understand static methods and variables
Tasks:
- Write a method called
fakeReview
that will replace adjectives in the given review *word with a random adjective.
Example:
A test file containing:The *quick *brown fox jumps over the *lazy dog.
may produce as its output:The speedy smoky fox jumps over the fast dog.
Activity 4 — Autogenerated Review
Time: 1 class period
Skills:
- Work with relational operators and conditional statements
Tasks:
- Upgrade the
fakeReview
method so that it generates a review with a stronger sentiment.
Lab 2 — Data Lab
The Data Lab works with the weather data from the data.gov site. What’s exciting about this lab is that it lets students work with real-world data.
One thing to note is that Data Lab requires you to work with an external library called Sinbad. The Sinbad library takes care of the challenges of retrieving the XML file, parsing data and creating objects with them. By using the library, you can focus on the key ideas of the project without having to deal with the challenging parts of fetching and processing the data.
However, it means that you’ll need to be able to reference documentation like this one and be able to understand how it works in your code. https://github.com/berry-cs/sinbad/blob/master/tutorials/java/welcome02-obj.md
The Ultimate Task: Create weather objects, assign XML data, and compare them.
Difficulty: ★
Introduce after: Unit 7
Total Class Periods: 8
Skills:
- Create a class and instantiate objects
- Compare values

Activity 1 — Data, Data, Data!
Time: 1 class period
Tasks:
- Discuss privacy policies
- Learn about file formats — csv, xlsx, JSON, XML
- explore data sets at http://www.data.gov and other sites.
Activity 2 — Designing and Implementing a Custom Class
Time: 1 class period
Skills:
- Create a class and instantiate objects
Tasks:
- Explore the given data in cereal.csv file
- Design and create a class — instance variables, constructors, getter methods
Activity 3 — Putting It All Together
Time: 2 class period
Skills:
- Create objects
- Put objects in an ArrayList. Traverse through it and compare data.
Tasks:
- Use the Sinbad library to work with the weather data.
- Compare data from three different locations — find the coldest location.
- Filter weather stations in a given state. Create and put WeatherStation objects in an ArrayList. Find the southernmost weather station.
Lab 3 — Steganography
Steganography is the art of hiding information in plain sight — a painting, crossword puzzles, advertisements and in other mundane looking places.
It is recommended but not required that students complete Picture Lab Activities. In the Picture Lab activities, the Steganography is recommended as an ‘Extensions’ activity.
Students need to understand binary systems, RGB values and how colors are represented using binary numbers. Here’s an introductory video that you can use in your class to discuss this topic → https://youtu.be/RjufWKLYkYo
The Ultimate Task: Conceal a secret message within a picture by altering pixel values.
Difficulty: ★★★
Introduce after: Unit 8
Total Class Periods: 6
Skills:
- Base conversions (binary ↔ decimal)
- Manipulating numbers using integer division, modulus, and type casting
- Array traversal

Activity 1 — Exploring Color
Time: 1 class period
Skills:
- Describe RGB hexadecimal values.
- Binary and decimal conversion
- Manipulate numbers using division and modulus
Tasks:
- Explore the hexadecimal value of colors
- Create an algorithm to alter the binary numbers of a color value.
- Create a Steganography class and create a method implementing the color alteration algorithm.
- Call the method on an image and compare before and after it was altered.
Activity 2 — Hiding and Revealing a Picture
Time: 1 class period
Skills:
- Manipulate numbers using division and modulus
- Type casting
Tasks:
- Write a method called
canHide
that determine if the source picture and the secret picture have the same width and height. - Write a method called hidePicture that uses an algorithm to hide the secret picture. Return the new picture.
Activity 3 — identifying a Hidden Picture
Time: 1 class period
Skills:
- Array traversal
Tasks:
- Write a method to compare if the two pictures are exactly the same.
- Write a method which takes the two pictures and make a list of the coordinates that are different.
- Write a method that draws a rectangle around the part of the picture that is different.
Activity 4 — Hiding and Revealing a Text Message
Time: 1 class period
Skills:
- Base conversion
- Array traversal
Tasks:
- Represent alphabet in decimal values.
- The rightmost two bits in each color value of each pixel are used to store the coded message.
- Apply the above logic in a method. Return the altered image that has the hidden message.
Lab 4 — Celebrity
Celebrity is a charades-like game where each player adds information about several “celebrities” to a pool. A random celebrity from the pool is picked and one player provides clues about the celebrity‘s identity to another player until the other player guesses the celebrity‘s name. The Celebrity covers similar programming concepts covered in the Elevens Lab such as designing a game with multiple classes and using inheritance to create a variation of the game.
Recommended to be introduced after Unit 9.
The Ultimate Task: Create a game of charades
Difficulty: ★★
Introduce after: Unit 9
Total Class Periods: 7
Skills:
- Creating classes using inheritance
- Using polymorphism concepts to create and work with subclass objects

Activity 1 — Introduction to Celebrity
Time: 1 class period
Skills:
- Design a class
Tasks:
- Play a game of Celebrity in teams. Write down 5 celebrity names. The reader picks a name then provides hints and the guesser guesses the name of the celebrity. When guessed right, the team wins a point. Then the next team plays for points.
- Design a Game class and a play method to create the Celebrity game using Java.
Activity 2 — The Celebrity Class: A Simple Version
Time: 1 class period
Skills:
- Create a class
Tasks:
- Create the Celebrity class and test it with a Runner file.
Activity 3 — Putting It All Together
Time: 1 class period
Skills:
- Work with multiple classes.
- Create ArrayList of objects.
Tasks:
- Work with CelebrityGame.java file
- Create an ArrayList of Celebrity objects and create a constructor.
- Complete the given method to validate that the Celebrity name entered in by the player has at least 4 characters.
- Complete the given method to validate that the Hint entered in by the player has at least 10 characters.
- Complete the
addCelebrity
method. - Complete the
getCelebrityGameSize
method. Simply return how many celebrities are in the list. - Complete the
processGuess
method. Return if the guess matches the celebrity name. - Complete the
sendClue
method. Simply return the clue.
Activity 4 — Extending the Celebrity Class
Time: 1 class period
Skills:
- Extend a class using inheritance
- Understand and apply polymorphism concepts to the program
Tasks:
- Analyze how the Fictional Celebrity game will diverge from the “default” Celebrity game.
- Create the Celebrity subclass
- Override methods as needed
- Write other methods as needed.
- Modify
addCelebrity
so that different types of subclass objects can be created and be added to the celebGameList. - Update the validator methods so it works with different types of objects.
- Modify GUI components.
We’ll be adding these labs to the Popfizz AP-CSA online course so that you can work on them using a browser and save your work on the cloud. Also, the labs will be introduced in steps with scaffolding questions and mini-projects to help along the way.

Check out the courses at http://popfizz.io