AP computer Science A
Syllabus:
2018_Syllabus_AP_CS_A_Block_6_DrBaharav.pdf
Older
2017_Syllabus_AP_CS_A_Block_4_6_Baharav.pdf
2016_Syllabus_AP_CS_A_Block_2_Baharav.pdf
==============
Book:
Java Methods, Third AP* Edition
Be sure to download from there: Student files ; Slides
==============
Practice online:
==============
Learn online:
==============
All classroom material is distributed through Github Classroom .
You need a github account for this.
We program together in class, and then links are given to students for the classroom assignment.
We often also code together in class CodingBat and PrcticeIt problems (and rarely hackerrank).
You will also open an account on CodingBat and PracticeIt.
On CodingBat, add me as your teacher (see profile settings).
==============
Course outline:
(a little bit of change is to be expected every year)
Intro and setup.
Topics: Setup the environment: JDK, IDE, Editor, Github.
This one does it all:
Installation_NetBeans_JDK_Eclipse.pdf
Just if you need: JDK: Oracle JavaSE IDE - NetBeans: https://netbeans.org/
Screen-shot
Editors: Atom [https://atom.io/ ] or Sublime [https://www.sublimetext.com/ ]
Netbeans and Git (Clone) ; https://github.com/
Resources for the Java Methods book: Student files ; Slides
In class activity: Syllabus. AP. Game of Nim (intro to algorithms). CodingBat (WarmUp). Installation.
"Hello World"
Topics: Command line, IDE, graphics, and GitHub classroom setup.
Code: "Hello World" Command line - Javac, java.
Code: "Hello World"" IDE - Working with the IDE.
Code: "Hello World" Graphics - Intro to graphics.
Code: "Hello World" Github - Working with IDE and github. Homework: First homework on Github Classroom.
Code: KPoint [github ] - Introduction to class, fields, methods, constructors. Homework: Add functionality to the point class.
Primitive types + Strings
Topics: Primitive types: Char, int, double, boolean.
Topics: Strings: Objects, length, substring, charAt, indexOf, compareTo, equals.
Drill: Codingbat- Warmup, String-1, no loops.
HelloName
FirstHalf
MissingChar .
HasBad .
sleepIn
11-string1-intro
PracticeIt : expressions
Code: KString [github ] - Our own String class. Homework: Hyphen2(), isPalindrome().
Code: TempConverter [github ] - Homework: Simple integer arithmetic.
Code: BaseConverter [github ] - Converting between Dec, Binary, Octal, and Hex. Homework: Complete the class.
Strings + primitve types: 14-prep-quiz2
Boolean + if()
Topics: Boolean, logical operators: Simple. De Morgan's law.
Topics: if().
Drill: Codingbat- logic-1. Warmup
02-logic_and_string_intro
Drill: PracticeIt-
Logic, not programming. Nice one to start! ifElseMystery1
Logic, little harder than 1. ifElseMystery2
Nice Programming quadrant
If/then/else: Do this one together in class, to see good programming style.
Coordinates
A little harder ones:
if/else with integer division. No program, just MC. ifElseSimulation
if/else Days in month: daysOfMonth
if/else Tax: Tax
Easy review: logic and String: 24-warm-up-review
8-quiz1-logic
While() and for() loops, and foreach()
21-warmup-whileloops
Hangman [github ] - Loops and strings. Homework: Complete the game.
for()
Codingbat- String-2, including loops.
22-inpairs-warmup-logicandloops
doubleChar
Bob there .
ZipZap . (not easy!)
xyBalance .Seems complicated, but has a VERY neat solution.
Quiz preparation:
25-loops-before-quiz
26-quiz3-loops
Nested for() loops
Triangles and pyramids [github ] - Nested loops for printing ASCII art. Homework: Complete shapes.
Langauge feature: break and continue.
Prime: isPrime(), allPrimesUpTo(), firstNPrimes() [
github ]
Codingbat- String-3, nested loops. Well, you might use. Don't have to. Paying attention to 'first time right' (or minimum times wrong). Then, paying attention to reduced code!
countTriple Simple one to start with.
gHappy - Logic makes it simple.
sameEnds
maxBlock - Not really complicated. Think simple.
withoutString - Two hints:
Use str.toLowerCase() when comparing.
Substitute from the ORIGINAL string (not from lowercase). Like the Hangman.
Codingbat- String-3, nested loops. Two problems I wrote to demeonstrate use of While() and use of tmp.
switchXwithNext - use of tmp.
stringCombine - multiple indexes.
Write your own CodingBat problems! Here is what the students came up with (very original!!):
CodingBat_StudentExercises_Strings.txt
ForEach loop - We did two things:
AP_Java_ForEach
AP_Java_ForEach_And_Spirals2D
Arrays
1D Array
Basic 1D array cnocepts and operations : [github ]
1D Array: CodingBat - Array-1 (no loops)
firstLast6
no23
sum3
makeLast
plusTwo
frontPiece
1D Array: CodingBat - Array-2 (loops)
countEvens
shiftLeft . Interesting.
sum67
centeredAverage . We'll do this one together as well.
1D Array: CodingBat - Array-2 (loops) and Array-3 (Nested or multiple loops)
twoTwo - Keep it simple: We have seen the pattern.
zeroFront - Special interest: Continue/break.
evenOdd - Indices. one loop.
Array-3
canBalance - Simple loops. Logic.
squareUp - Indices. Nested loop. simple logic.
Write your own CodingBat problems! Here is what the students came up with (very original!!):
CodingBat_StudentExercises_Arrays.txt
PracticeIt warmups:
arrayMystey-final1
arrayMystey-final2
Random: java.util.Random and Math.random. Command line arguments. Homework: 1D array shuffle [
github ].
(We did not do this year) Homework: Fibonnaci class (return array, return element, return next element) [
github ].
2D Array
Magic square [github ].
Homework: Haiku (2D array decoding) [github ].
Some more workouts on Arrays - CodingBat.
0-block:
1D to 2D array of ints . (zz530_1dTo2DInts).
Blitz:
commonEnd
maxEnd3
double23
HW:
Array of Strings . (zz520_longestString).
countClumps (medium/hard)
fix34 (challenging)
Mirror (hard)
Bubble sort : Wrapping up 1D array, and talking about sorting (time, space) [
github ].
0-block :
PracticeIt: Mystery array.
sum/difference
2D ascii art .
Some fun with arrays and strings:
wordsCount
scoresSpecial: Helper function
mergeTwo : Strings and arrays
OOP:: Methods, Class
Primes example in class [
github ].
static/class variable/method
Euler problems homework:
Euler7 - 10,001 prime. We'll do together in class
Euler9 - Pythagorean triplet
Euler39 - Integer right triangle
Euler46 - Goldbach's other conjecture. BTW, his other conjecture: Every even integer greater than 2 can be expressed as the sum of two primes. I would recommend the book "Uncle Petros and Goldbach's Conjecture")
OOP:: Inheritance :
Basic concepts:
Bank account example: Inheritance, Encapsulation, 'extends', this, super (dot notation, constructor), constructor. Overloading methods toString, static/class variable. Array of objects, casting. Which function is called? determined by the OBJECT
itself.
BankAccount
[HW] Person
Person Github
Interfaces and Abstract classes :
Implements keyword, Abstract keyword
Interface - Contract ; Abstract -
Examples we used:
Inheritance: Simple BankAccount:
Inheritance BankAccount
Abstract class: Animal:
Abstract Animal
Interface class: Costable:
Interface Costable
Mobile example, interface -
Mobile
Shape example, abstract
Shape
[HW] Animal
PracticeIt:
Comparable interface : Git
NTU problems: :
The whole deal: https://www.ntu.edu.sg/home/ehchua/programming/index.html
https://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html
https://www.ntu.edu.sg/home/ehchua/programming/java/J3f_OOPExercises.html
ArrayList
ArrayList shuffle: [
github files ].
ArrayList Josephus: [
github files ].
ArrayList AlwaysSorted: [
github files ].
Recursion : Factorial, Towers of Hanoi, palindrome. [
github files ].
Search and Sort
Search: Sequential, binary. []github files ].
Sort: Bubble, Selection, Insertion, Merge. [github files ].
Larger projects :
Conway game of life: Logic [
github files ].
Battle Ship: AI [
github ].
Practicing: AP-FR We are doing many. See for example :
AP_FR_TheOnesYouDid_solution.pdf ; [AP_FR_TheOnesYouDid_solution.docx
]
FR_2013_4_2DArray: Skyview, raster scan. (medium)
FR_2012_4_2DImage: Simple 2D array processing. (easy)
FR_2017_3_String: String operation. (medium)
The whole material
============
+++++++++++++++
^ Password protected.
*
**
==================================
Questions/Comments: Zbaharav at Kehillah dot Org or Zachi at Baharav dot Org .