AP Computer Science
       Case Study         





AP Computer Science

You are not alone, we are a community of programmers.

"In the one and only true way. The object-oriented version of 'Spaghetti code' is, of course, 'Lasagna code'. (Too many layers)."
- Roberto Waltman.









.
Preparing for AP Computer Science
2012 - 2013

.

These assignments are only for students who did not take java in the school year 2011-2012

Zip your work an email it to the teacher as you complete the work.

All work should turned in by August 20th.
.
.

Introduction
All review and Programming Exercises at the end of the chapter


An Introduction to Objects and Classes
All review and Programming Exercises at the end of the chapter
.


Fundamental Data Types
All review and Programming Exercises at the end of the chapter


Applets and Graphics
Only Programming Exercises at the end of the chapter


Decisions
All review and Programming Exercises at the end of the chapter


Iteration
All review and Programming Exercises at the end of the chapter




Designing Classes
All review and Programming Exercises at the end of the chapter

Some solutions. Use them only to check your work or to understand the assignment!
.







  




Types
OOD
Inheritance
Collections
Linked Lists
Arrays and  
 ArrayLists









Current Assignments




Day
Date
Class Work
Homework
92
2/1
Midterm Case Study Implementation

Read pages 454 through 458.
Write the pseudocode for a Fibonacci


.
93
2/2

Finish Midterm question 4

Recursion
Programming project 8.3
Implement Fibonacci and Factorial code

Write pseudocode for programming projects 8.1 and 8.2

Read pages 459 through 464.


94
2/3

Recursion
Implement programming projects 8.1 and 8.2

A group of Princeton University Computer Science students led by Max Rabinovich will be holding a java programming workshop on Mondays and Wednesdays starting at 3 in room 242. The workshop will start from basic concepts to advanced and sophisticated implementations. Projects will include N-body simulations, Graphical Representations using the StdDraw library, Data Types I and II, and Guitar Hero simulator.

Students from my classes who join the workshop will grade extra credit for the remaining marking periods.
.

Re-write Fibonacci and Factorial sources using iteration based algorithms





95
2/6
.
Recursion
Comparison between iteration and recursion
Direct and indirect recursion




SR questions 8.1-8.6
MC 8.1-8.6
SA 8.1 and 8.2

Read pages 465 through 468





96
2/7

Recursion
Use your own images for the TiledPictures.java program to create your own recursive graphics.

Use KochPanel.java to write your own applet with a different background.

.

Programming project 8.4 (3D Maze)
SA 8.3 and answer last sentence from SA 8.4
97
2/8

Recursion
Recursice sort: Merge Sort
Trace the merge sort.

.

Complete tracing the merge sort.
Read pages 469 through 474
98
2/9

Recursion
Recursice sort: Merge Sort
Trace the merge sort.
.

Use the Question class and QuizTime from chapter 6 to test your merge sort. Look at Programming Projects 6.9 and 6.10 (Also look into chapter 5)

.
99
2/10

Recursion
Completion of assignments
.

SA 8.5 and 8.7
Write the story of the merge sort in plain Engish..
..
100
2/13

Recursion

The Bubble sort code has been added at the end of the document.
.

Read pages 475 through 476

Write code for QuickSorting objects.
.

.
101
2/14

Recursion


Think of non-recursive quickSort.


Write the story of the quick sort in plain English.
.
Write a recursive Binary Search method
.

102
2/15

Recursion Test Review
.
103
2/16

Recursion Test
.



Day
Date
Class Work
Homework
83
1/20

Recursion
Maze algorithm
..

Finish the small maze worksheet
..
84
1/23

Recursion
Small maze
..

MC questions 1 - 10 from chapters 1 and 2
.
85
1/24

Midterm Review
MC questions 1 - 10 from chapters 3, 4
..
MC questions 11 - 21 from chapters 1, 2 and 1-10 from chapter 13(Case Study)
.MC
86
1/25

Midterm Review


.
87
1/26


Midterm Exams start
..


.
87
1/27

Midterm Exams
..


88
1/30


Midterm Exams
..


.
88
1/31


Midterm Exams
..
.


92
2/1
Midterm Case Study Implementation

Read pages 454 through 458.
Write the pseudocode for a Fibonacci


.
93
2/2

Finish Midterm question 4

Recursion
Programming project 8.3
Fibonacci and Factorial code

Write pseudocode for programming projects 8.1 and 8.2

Read pages 459 through 464.


94
2/3

Recursion
Implement programming projects 8.1 and 8.2

A group of Princeton University Computer Science students led by Max Rabinovich will be holding a java programming workshop on Mondays and Wednesdays starting at 3 in room 242. The workshop will start from basic concepts to advanced and sophisticated implementations. Projects will include N-body simulations, Graphical Representations using the StdDraw library, Data Types I and II, and Guitar Hero simulator.

Students from my classes who join the workshop will grade extra credit for the remaining marking periods.
.

Re-write Fibonacci and Factorial sources using iteration based algorithms

Programming project 8.4 pseudocode

Write code for QuickSorting objects.

Use the Question class and QuizTime from chapter 6 to test your new sort. Look at Programming Projects 6.9 and 6.10

95
2/6
.
Recursion
Programming project 8.10 and choose one of the following programming projects: 8.6 through 8.9
Analysis and Big O notation


Think of non-recursive quickSort.
Recursive sort: Quick Sort


Recursion
Recursice sort: Merge Sort
Analysis and Big O notation

SR questions 1-6

Read pages 465 through 468

Write pseudocode for Hanoi Towers

MC 1-10

Short answers: 1-6

Programming project 8.9 pseudocode

Read pages 469 through 476

SR question 8

Programming project 8.10

MC hand-out





Write the story of the quick sort in plain English.
Make sure you have all the programs in your folder.



Write the story of the merge sort in plain Engish.
.

Merge Sort Tracing

Write a recursive Binary Search method
Tomorrow's Quiz: Binary Search.
.



Trace the merge sort for the first for 4 elements of the array. Note: just the doMergeSort.

Write the story of the quick sort in plain Engish.
Tomorrow's Quiz: Linear Search
..

Sort Project due at the end of tomorrow's period. The Bubble sort code has been added at the end of the document.
..

Tomorrow's Quiz: Selection Sort
.

Monday's Quiz: Insertion sort
MC questions 1-6
..


.


Day
Date
Class Work
Homework
61
12/9

GridWorld Case Study

.

Set 1 and Excersices 1-10 on page 6
62
12/12

GridWorld Case Study
Set 2 and Excersices 1and 2 on pages 12 and 13
.

Excersices 3 and 4 on pages 14 and 15
63
12/13

GridWorld Case Study

Set 3 page 19 and Set 4 on page 21
...

Exercise 5 on page 15
and Set 5 on page 23

64
12/14

GridWorld Case Study
Set 6 on page 25
.

Complete Set 6
65
12/15

GridWorld Case Study
Group Activity: 1and 2 a-f


Study the Grid World material up to now. Create a summary of sets 1 thru 3 and exercises related to the sets. Include code and comments.
.
66
12/16

GridWorld Case Study
Group Activity: 3 and 4
.

Complete all the sets from 1 through 6
67
12/19

GridWorld Case Study
Finish the Group Activity

.


Study the Grid World material up to now. Create a summary of sets 4 thru 6 and exercises related to the sets. Include related code snippets and comments.

MC 1-5
.
68
12/20

GridWorld Case Study
Review for test

.

69
12/21
GridWorld Case Study
Review for test

.


.
70
12/22


GridWorld Case Study
Test 1




Enjoy the winter break!!!


christmas-animated-gifs-06.gif

happy-new-year-animated-gif-2.gif
72

1/3/2012

GridWorld Case Study
Colibri world and Colibri actor.
Find an image of a hummingbird for a new actor. Create a new world with a colibri as its actor. Be creative and make your world unique with a different shape (not a 10 by 10 grid) and color.


.

Write a document describing the world and the new actor.
Make sure you include the attributes and behaviors and the public interface.
73
1/4

GridWorld Case Study
New world and actor


..



74
1/5

GridWorld Case Study
New world and actor is due at the end of the period
.

GridWorld Case Study
Start Part 4 and do Set 7

75
1/6

GridWorld Case Study
Part 4: Sets 8 and 9
Exercises 1 thru 4
Write down the five postconditons on the Critter methods. (To be collected)
.

Exercises 5 and 6
76
1/9

GridWorld Case Study
Group Activity 1-2

.

Summarize 1 and 5 from Java Programming Style Guidelines
77
1/10

GridWorld Case Study
Group Activity 3 and 4

MC

78
1/11

GridWorld Case Study
Review for Part 4 Test



Study for Part 4 Test
82
1/19

GridWorld Case Study
Part 4 Test





Day
Date
Class work
Assignments
54
11/29

Inheritance
Polymorphism

Inheritance
Creating subclasses
Overriding methods
Class hierarchies
.

Read from page 382 through 395
MC question 7-10
SR questions 7.1-7.8
.
55
11/30

Inheritance
Abstract Classes

Inheritance
Programming Project 7.1
Design and implement a class called MonetaryCoin that is derived from the Coin class presented in Chapter 4. Store a value in the monetary coin that represents its value and add a method that returns its value. Create a main driver class to instantiate and compute the sum of several MonetaryCoin objects. Show that a monetary coin inherits its parent's ability to be flipped.
.

Read up to page 410
Self review questions 7.9 through 7.12
MC questions 7.1 through 7.6
.
56
12/1

Inheritance

Programmng Project 7.2
Design and implement a set of classes that define the employees of a hospital: doctor, nurse, administrator, surgeon, receptionist, janitor, and so on. Include methods in each class that are named according to the services provided by that person and print an appropriate message. Create a main driver class to instantiate several of the classes.This assingment shuold demonstrate the use of inheritance by displaying the "is-a" relationship.
.

Read up to page 418
Short answers 7.1 through 7.5

Write a summary for inheritance. Include specific concepts: superclass and its other names, child class and its other name, overloading and overriding, the keyword extend, is-a relationship and super reference. Mention the visibility concept and abstract features for the like and unlike comparisons to interfaces.
.
57
12/2


Create a Power Point Presentation with the following topics:

How technology has an impact on a field of your choice.

Use images and short paragraphs.
The ppp should have at least 5 slides.
Include the URL's for each source.
.



.

MC 7.7 through 7.10
T/F questions 7.1 through 7.10
Read up to page 422
58
12/5

Inheritance
SA 7.4 and 7.5
7.4 Experiment with a simple is-a relationship between two classes. Put println statements in constructors of both the parent and child classes. Do not call the constructor of the parent in the child. What happens? Why? Change the child's constructor to call the constructor of the parent. Now what happens?

7.5 What would happen if the pay method were not defined as an abstract method in the StaffMernber class of the program in Listing 7.20?

.

Write on paper the code and draw the UML class diagram for programming projects 7.4

Implement programming project 7.4:
Design and implement a set of classes that keeps track of sports statistics. Have each low-level class represent a specific sport. Tailor the services of the classes to the Sport in question, and move common attributes to the higher-level classes. Create a main driver class to instantiate several of the classes.
.

59
12/6

Chapter 7 test review

.

Programming project 7.5:
Design and implement a set of classes that keeps track of information about a set of people, such as age, nationality, occupation, income, and so on. Design each class to focus on a particular aspect of data collection. Create a main driver class to instantiate several of the classes.
.
60
12/7


Inheritance and Polymorphism Test



Draw UML class diagram for Programming Project 7.5
.
61
12/9

Draw a flowchart for the following programming assignment:
A program reads in three floating-point numbers and prints the largest, middle and smallest of the three inputs.

For example:
Please enter three numbers:
4 9 2
Largest number is 9.
Middle number is 4.
Smallest number is 2

Then create a Test Suite for your flowchart. Trace the path of your algorithm through the flowchart, write the program, run it for the data you use in the Test Suite and print both the program and output. Staple all your documents and turn it in.

.


Finish class work.

Read pages 3 through 6 on the Case Study and answer 1-10 questions on Set 1on page 6.



Day
Date
Class Work
Homework
36
10/28

Chapter 6
Arrays: array indexing, declaring and using arrays, initializer lists, and arrays of objects.
Listings 6.1 through 6.6

.

Read up to page 312 inclusive
Answer multiple choice questions 1-4.
37
10/31

Enjoy Halloween!

.
ANImummy.gif

Chapter 6
Filling arrays of objects
Listings 6.7 through 6.9
Work on programming projects 6.1 and 6.4
.




.
38
11/1

Chapter 6
Filling arrays of objects
Listings 6.7 through 6.9
Work on programming projects 6.1 and 6.4

.

Read up to page 316
Short Answers 6.1-6.6

Programming Project 6.6
Include UML for this program

What exception does MC 6.1 part c give? Is it at runtime or compilation time?
.
39
11/2
Chapter 6
Searches: sequential and binary
Listings 6.10 through 6.12
.

Read up to page 321
Self-review 6.1-6.5
T/F 6.1-6.7
Write the story of the two searches
.
40
11/3

Chapter 6
Sorting: selection and insertion, sorting an array of objects
Listings 6.13 through 6.16
..

Read up to page 329
Write the story of the two sorts
.
41
11/4

Chapter 6
Sorting: Write the story of the insertion sort and implement your favorite sort.

Programming Project: Modify the selection sort algorithm to sort objects. Write a test class, CoinArrayTest. Create an array of coins and sort it by their values. Print the new array of coins.
..

Read up to page 331
.

.
42
11/7

Chapter 6
Comparing Sorts
Hashing
Two-dimensional Arrays
Parallel arrays





Read up to page 337 from textbook

Big Java Chapter 13:
Read pages 534-541
Ex R13.6 and R13.9




.
43
11/8
.
Chapter 6
Exercises: P13.18 and P13.19

or P13.20



Big Java Chapter 13:
Read up to page 547
Ex R13.10 and 13R.14

Draft of algorithm for programming projects 6.9 and 6.10







44

11/9


Array Lists

Create classes Purse and Coin on page this chapter
Implement the driver class for Purse.
Write the test class and show all the ArrayList services.


.
.


Read pages 522 through 529 on Big Java
Review Exercises R13.1, R13.3 and R13.4
Read common error 13.4 on page 533

Exercises: P13.1 through P13.6
Exercises: P13.7 and P13.8
.
45
11/14

Array Lists
Exercise P13.9
.

Create a document with the ArrayList API. Describe each method with a short paragraph.
.
46
11/15

Generic Types

.

Exercises: P13.1 through P13.6
Exercises: P13.7 and P13.8
Exercise P13.9

47
11/16

Note: if you have late assignments to turn in, zip them and email them to me.

Generic Types
Coin-Purse application revisited:
a. Re-Write class Purse with generic types.
b. Re-write the method getTotal() with the enhanced for loop.
c. Write a new method: find(Coin aCoin). It returns true if it finds it or false otherwise.
.

Read:
Type Variables
Implementing Generic Classes


Answer the following questions:

Use the Generic Pair Class to Construct a Pair of Strings. How would you use the negeric Pair class to contruct a pair of strings "Hello" and "World"?


.
48
11/17

Do Review Problems: 1 through 6 and Self Check questions 5 and 6

.
49
11/18

Do Review Problems: 1 through 6
Review for Arrays, ArrayLists and Generics Test
.

50
11/21

Arrays, ArrayLists and Generics Test
.
53
11/28

Write an applet that displays a bar graph. Use an array of integers to draw the bars.
Use the resources from Big Java on the link below



Selection Sort Animation
Implement a graphical animation of sorting and searching algorithms. Fill an array with a set of random numbers between 1 and 100. Draw each array element as a bar, as in figure. Whenever the algorithm changes the array, wait for the user to click a button, then call the repaint method. The program highlights the currently inspected element and the current values of from and to.

SelSortAnimation.png

Note: dont forget what you learned in Event handlers and buttons

Note
No

.

Complete assignment


Day
Date
Class Work
Homework
28
10/18

Chapter 5
Read 253 to 258
Do Programming project 5.1



.

Read 259 to 262
Self-Review problem 5.1 to 5.5
MC 5.1 to 5.3

.
.
29
10/19

Chapter 5
Discussions on References revisited, the static modifier and exceptions


.

Short answers 5.1 and 5.2
T/F 5.1 to 5.8

30
10/20

Chapter 5
Interfaces


.

Read 263 to 269
31
10/21

Chapter 5
Interfaces
Have the Die class implement the Measurable interface. Generate dice, cast them, and add them to the DataSet

.

Define a class Quiz that implements the Measurable interface. A quiz has a score and a letter grade (such as B+). Use the DataSet class to process a collection of quizzes. Display the average score and the quiz with the highest score ( both letter grade and score)

Programming Project 5.6
Self-Review problem 5.6 and 5.7
MC 5.4 to 5.10

.
32
10/24

Chapter 5
The Comparable, List, Iterator and ListIterator interfaces
Programming Project 5.3 to 5.4
Designing classes

.

Short answers 5.3 to 5.6
T/F 5.9 and 5.10
Finish Programming Project 5.3 to 5.4
Review Exercises R9.1 to R9.4 (Big Java)
33
10/25

Chapter 5 Test Review


.
34
10/26

Chapter 5 Test


.



Day
Date
Class Work
Homework
24
10/12

Chapter 4
Programmin Projects: 4.3 through 4.6


.

Short Answer 4.4 through 4.10
.
.
25
10/13

Chapter 4
Programmin Projects: 4.3 through 4.6

.

.Short Answer 4.11 through 4.19
26
10/14

Chapter 4 Test Review


.
27
10/17

Chapter 4 Test


.

Read pages 248 through 252
.


Day
Date
Class Work
Homework
19
10/5

Event Handlers
Mouse Event
.

Read pages 396 through 402
Review Exercise R10.1

20
10/6

Event Handlers
Use MouseListener and MouseMotionListener to draw on an applet when you keep the mouse pressed.

.

21
10/7

Event Handlers
Use MouseListener and MouseMotionListener to draw on an applet when you keep the mouse pressed.

.

Read pages 190 through 200 from AP textbook
22
10/10

Event Handlers
MouseListener and MouseMotionListener

.

Self-Review questions 4.1-4.11
23
10/11

Event Handlers
Programming Exercise P10.1 - P10.3

.

MC 4.1-4.10
T/F 4.1 - 4.10
.


Day
Date
Class Work
Homework
10
9/21

Chapter 3
Programming Projects: 3.1 and 3.2

.


Multiple choice questions: 3.8 through 3.10
Short Answers: 3.6 through 3.9
.
11
9/22

Chapter 3
Programming Projects: 3.11 and 3.12

.

Draw a flowchart for program 3.12
T/F questions
.
12
9/23

Chapter 3
Programming Projects: 3.13 and 3.15

.


Short Answers: 3.11 through 3.14
Draw Flowcharts for each
.
13
9/26

Chapter 3
Programming Projects: 3.16

.


Short Answers: 3.51 through 3.17
Draw Flowcharts for each
.
14
9/27

Chapter 3
Programming Projects: 3.18

.

Short Answers: 3.18 through 3.19
Draw Flowcharts for each
.
15
9/28

Chapter 3
Complete assignments
Note: drop your finished work in the Dropbox

.
16
9/30

Chapter 3
Complete assignments
Note: drop your finished work in the Dropbox
Note: You can move to chapter 4 if you are finished with all of chapter 3 assignments.
.
17
10/3

Chapter 3 Test Review
.
18
10/4
.
Chapter 3 Test
 .



.





Day
Date
Class Work
Homework
1
9/8

Introductions
.
2
9/9

The Birthday Problem Algorithm
.

Finish up the Birthday Problem  Flowchart
3
9/12

The Birthday Problem Algorithm Implementation
.


Read section 1.4: programming language levels, compilers and interpreters and syntax and semantics from textbook.
.
4
9/13

Chapter 1 Discussions
.

Self-review questions:
1.4, 1.5, 1.11-1.14
Multiple choice questions:
1.1-1.8
.
5
9/14

Chapter 2
Objects, strings literals, variables, primitive data types and ADT's
.

Self-review questions:
2.1-2.4
Multiple choice questions:
2.1-2.3
.
6
9/15

Chapter 2
Arithmetic expressions, creating objects and class libraries
.

Self-review questions:
2.5-2.10
Multiple choice questions:
2.4-2.8
.
7
9/16

Chapter 2
Formattin output and applets
.
Programming project 2.13

Self-review questions:
2.11-2.19
Multiple choice questions:
2.9-2.10
True/False:
2.1-2.8
Short Answer:
2.5, 2.6, 2.11 and 2.12
.
8
9/19

Chapter 2
Test review
.


.
.
9
9/20

.Chapter 2 Test
.

Chapter 3
Multiple choice questions: 3.1 through 3.7
Short Answers: 3.2 through 3.5
.



.












Concepts Time Table
Approximate Completion   Date
Language Concepts
Arrays, ArrayList and Generic types  
September - October - November
Searching and Sorts(2)
November - December
Inheritance
December
Recursion
February
Sorts(3)
February
GridWorld Case Study
Intro to GridWorld
December - January
Linked Structures
February
Stacks and Queues
March
Collections and Sets
March
April
April
AP Exam
May 8th @ 8 AM
Sets and Maps
May
Trees and Binary Search Trees
May
Heaps
May
Lists
May
GridWorld Case Study
Completion
June
Project
June




                                





Mrs. Elia’s
“Company Policy”


School Year 2011-2012

AP Computer Science
There will be no eating in the classroom.

Grade composition:

20% Homework, folder and notebook
20% Daily class participation, activities and pop quizzes
60% Quizzes and Tests

Projects
Some projects will be counted as a Test (60%) and some will be graded as Class activity (20%).

Homework
The student is responsible for completion and correction of homework assigned.
Homework will be checked every day. Neatness and completeness is important. All material should be kept in the math folder or notebook.
Computer Science folder (Company rules must be included)
The math folder should contain homework, class notes, class activities, projects pop quizzes, quizzes and tests. I will collect it at random without notice every marking period for grading.
 Note: After midterm, you can leave all the material home and start with a clean folder.

Tardiness
Class starts immediately!
Every student is expected to be in the classroom and prepared for class no later than two minutes after the second bell rings. There will be “break-detention” for the student who is late. Chronic offenders will be contacted at home.

Absence
Student is responsible for making up work missed. Check Mrs. Elia’s classes in the PHS website for lessons and assignments. During periods 1 and 4 I’m available for questions. Hours after school can also be scheduled by appointment.

Absent for a test or quiz
If you are absent the day of an announced quiz or test, you are expected to take the quiz/test on the day you return. In any other circumstance the make up test and quiz must be taken within the first two days after returning to school. If the make up is not taken, it is a zero.




Cheating policy… “Absolute zero”. Plus parents will be contacted.

Programs should be your own creation.

Textbooks: As soon as you get your book, write your name on the back of front cover
It must be covered at all times and well cared for. The cost of your book is $80. Book must be returned in good conditions (or pay a fine) 10 days before end of school. Otherwise report cards will be withheld.

What to bring to the classroom
Your own calculator           Pencil or pen            Folder           Books
Nobody can borrow calculators during a quiz, test or pop quiz.

What not to bring to the classroom
Food        sunglasses   ipod      cell phones (keep it in your book bag)
Any of these items I find, I will turn them over to main office.



How to contact Mrs. Elia
My office is in room 234 but you can find me in room 242 most of the day. I am available during 2nd, 4th periods, break and after school.
My telephone number is (609) 806-4280 extension 3631.
My email address is graciela_elia@monet.prs.k12.nj.us. I encourage you to communicate with me as much as possible.

*All terms and conditions are subject to change with written notification by Mrs. Elia