Practice Labs and Solutions for AP Computer Science A
Here I will explain the format of this repository, which is extra Labs to do in AP Computer Science A from my high school's class. For each unit, take a look at the pdf, try writing the programs, and see my solutions.
Unit 1: Primitive Types
First, you can take a look at HelloWorld.java, which is typically the first program students write. ScannerExample.java shows how to take user input in a program. Then, read the APCS Unit 1 Lab Exercises PDF and try to write the two programs on your own. MathFunctions.java and LunchTime.java are my sample solutions.
Unit 2: Objects
Three of the labs have Tester Labs that must be run in the same project in order for the code to work. Additionally, I wrote AdventureLab.java, which is a program for the game hangman that might be helpful to take a look at.
Unit 3: Conditionals
This is a 3-part lab in APCS Unit 3 Lab Exercises.pdf. The parts are labeled LabPart1.java, LabPart2.java, and LabPart3.java.
Unit 4: Iterations
Each lab is named accordingly (sorry-- ATM actually shouldn't have 'machine' after it-- the 'm' already stands for 'machine'!).
Unit 5: Writing Classes
Labs include Ticket Generator Lab and Tax Lab and their respective Tester classes.
Unit 6: Arrays
The first page corresponds to FibonacciLab.java, PythagoreanTriple.java, and Scrabble.java. The second page is all in ForEach.java, and the third page corresponds to TenIntsLab.java and Hangman.java, and the last lab is War.java.
Unit 7: ArrayLists
HungryHerman.java, GroceryList.java, and Dictionary.java all correspond to their respective labs. Additionally, Word.java is a class for the Dictionary Lab. Die.java, DieCup.java, and DiceGame.java are all classes for the Yahtzee Lab.
Unit 8: 2D Arrays
Labs are labeled ArraysStarter.java, Matrices.java, and TicTacToe.java.