|
AP Computer Science
Advanced Placement Computer Science Page
Quick Reference of A Exam | AP Computer Science AB | C++
| netstat | my blog
− General Resources
Good sites dedicated to AP comp sci topics
- link 1
Presentation Dates
- Monday March 4th: Tanner
- Tuesday March 5th: Anthony, Alysandra
- Wednesday March 6th: Matt
- Thursday March 7th: James
Presentations
- Interfaces: Matt
- compare to Abstract Classes
- Critters vs Bugs: Tanner
- differences, similarities, what are appropriate subclasses
- Grid and Location: Alysandra, Anthony
- functionality of
- where/how are these used in the Actor, Bug, Critter classes
- Inheritance: James
- special attention to Abstract Classes
- when to use
- distinguish from interface
THe problems below should be completed by the time you return from Vacation
Unit 8: Sorting and Searching
Let's Review Arrays
- Complete the class below
public class ArrayFun {
double[] dArray;
public ArrayFun(){
System.out.println("initilize dArray");
}
public double largestVal() {
return 1.0;
}
public double smallestVal() {
return 1.0;
}
public double secondLargestVal() {
return 1.0;
}
//initilize dArray to have numberOfElements
// with a minimum value of min and max value of max
public void intializeRandom(int max, int min, int numberOfElements){
//initialize a
}
public double calcMean(){ return -1;;}
public double calcMode(){ return -1;}
public double calcMedian(){ return -1;}
}
I. Sorting
- 1) Rewrite the Sorts class from p.346 so that both sorting algorithms(Selection and Insertion) put the values in descending order.
- 2) Read about merge sort p. 482- 487
- 3) Go to the following urls and answer the following questions
URL (By the way, use the Double Storage Merge Sort)
| Sort |
Data |
# comparisons ? |
# swaps (called 'moves' in the demo) |
# comparisons
+# swaps
|
| Selection |
Random |
|
|
|
| Insertion |
Random |
|
|
|
| Merge |
Random |
|
|
|
| |
|
|
|
|
| Selection |
in order |
|
|
|
| Insertion |
in order |
|
|
|
| Merge |
in order |
|
|
|
| |
|
|
|
|
| Selection |
Reverse Order |
|
|
|
| Insertion |
Reverse Order |
|
|
|
| Merge |
Reverse Order |
|
|
|
Rate each sort from 1 to 3, 1 being the best 3 being the worst. By the way, if your curious check out QuickSort. Find out if it's really 'quick'
Unit 7: Critters
How to get all Actors inside 3
- Complete ChameloenCritter, ChameleonKid, and RockHound by Monday March 2nd
- All Critter projects are due Monday March 9th.
- Thursday March 3/5
- 1) Declare and initialize an arrayList of Locations
- write a loop tha adds twenty locations with a random row and a random colun
- the random row/col should range from 0 to 15
- 2) p. 453 1 - 4
- Friday March 3/6
- p. 453 7.5, 7.6 , 7.8, 7.9
- Monday March 9th
- 1) Write a class called
printOutBug that
- extends Bug
- after every move, prints out the Location of each non-bug in the grid
- 2) Write a class called
printOutBug2 that
- extends Bug
- prints out all empty Locations in the grid
- 3) Write a class called
BugCategorizer that extends Bug
- the constructor should take a a String Parameter that represents one of the following classes: Rock,Critter, or Bug
- add a method called
int categorize() that is called by the act() method
- based on the constructor's parameter , categorize() should return count up the number of instances of a given class
-
For instance, if the red bug in the picture below was a BugCategorizer('Rock') then its categorize() would return 1;
- 4) Modify the
BugCategorizer 's method int categorize() . Make this method only count the objects(Bugs, Critters or whatever was set in the constructor) that are within 3 spaces ahead or behind the BugCategorizer.
- 5) Write a class called ShyBug that extends Bug. This class should
- determine how many other bugs are within 2 spaces of itself.
- if there is 3 or more Actors of any type within 2 spaces the Shy bug's color darkens, and it does not move at all.
- otherwise, the shy Bug's color lightens and the bug behaves like a normal bug.
6) Write a class called HistoryCritter that acts like a critter in every way plus it
- prints out a history of all Actors that it processed after every move
- 7) Write a class called ForgetFullCritter that extends History Critter and
- has a constructor that takes a parameter representing how many steps in the history it will remember before forgetting all prior acts beforehand.
Unit 6: Interfaces
- page 279 in book
- Programming projects
- Write a class called
PigLatinTranslator. Design this class any way you want but it should have methods that perform Pig Latin Translation
- The
PigLatinTranslator should implement an interface called Translatable
- The
Translatable interface should have a method with the following header
String translate(String strToTranslate)
- Modify the bank account project as follows
- SavingsAccount and CheckingAccount should both implement the
Comparable interface
- implement the 1 method of
Comparable
int compareTo(Object otherAccount)
- note: You must cast the paramater otherAccount
- ie to cast otherAccount to be of type Checking account you use the following code
- CheckingAccount ca = (CheckingAccount)otherAccount
- Create a new class called
Bank
Bank should have the following variables
ArrayList<Account> activeAccounts
ArrayList<Account> suspendedAccounts
Bank should also have the following methods
void suspendAccount(Account someAccount)
- this method moves an account from
activeAccounts to suspendedAccounts
void activateAccount(Account someAccount)
- this method moves an account from
suspendedAccounts to activeAccounts
- void ArrayList<Account> orderAccounts(ArrayList<Account> accounts) (* a challenging method to implement, only people striving to get an A on this project should do this one)
Unit 5: Gridworld and OOP
- Abstract Classes
(page 409)
− Unit 4: ArrayLists and GridWorld
ArrayLists
| Links and Projects |
Homework |
| Grid Wolrd Student Manual Part I and II |
complete part II by Friday |
| Spinning Actor Lab |
|
| Bug Sub Class Labs |
By Monday, spinning Actor and SlowBug should be completed. Each should have its own "Runner" class |
| Fast Bug |
This project should be completed before the vacation (I will grade it when you return) |
| Christmas Vacation Homework |
Complete part 3 from the GridWorld Case Study Student Manual |
− Unit 3: Strings and Arrays
- Java Strings
Unit 3 Homework
- Wednesday October 22nd: Read pages 82 - 85
- Thursday October 23rd: page 114-115 #'s 2.1,2.3,2.7, 2.9
- Friday October 24th: Work on the String programming projects (On Tuesday, we will start with Java Arrays )
- Monday October 25th: Read pages 318 - 322. Is an Array a primitive data type?
- Tuesday October 26th: Work on String and array projects. String projects are due next Monday.
- Wednesday, Thursday, Friday: Complete String validation project
- Wednesday November 5th : page 378-379 6.1,6.2, 6.3, 6.4
- Thursday November 6 th :
- page 380 6.8
- page 381
- (True/False) 6.1, 6.3, 6.5
- (p.382, short answer) 6.3
- Monday November 10 th :
- Wednesday November 12th:
- Thursday November 13th/Friday 14th:
- 1) Friday is the last day to work on the Array Javabat problems (they will be due a week from Monday(monday 11/24th)
- 2) 6.4, 6.5
− Unit 2: Primitive Data, Objects & Review
- Download review sheet for test 2
- 1) overloaded constructors
- 2) code reuse
- 3) doubles, ints and how to convert from one type to another
- 4) arithemetic
- 5) for and while loops
- 6) nested loops
Homework
− Unit 1 : Number Systems and CS Terms
Test 1. Friday September 12th
Topics - 1) number systems and conversions(see class handout)
- 2) CS terms and concepts
- 3) Overloaded constructor
- a) what is 'overloading(Examples from Jeroo)
- b) what are the 2 ways that we can overload
- c) what is a constructor
- Here is the exact wording of one of the questions.
Below are two snippets of code from a Jeroo program. Underneath each, explain,specifically, how each one exemplifies an ‘overloaded constructor.’
- 4) Recursion
- base case
- infinite recursion
- Friday Sept 12th
- Read pages 26 - 34 and 58 - 62 in your text book
- install eclipse and BlueJ
- keep working on Jeroo Recursion Projects which are due Tuesday teh 16th
Unit 1 HW
- Tuesday Sept 8th:
- 1) read "Number Systems" handout. pages 681-687
- 2) Continue working on Jeroo activities
- Thursday Sept. 11th: test tomorrow
Upcoming Deadlines
- Jeroo Recursion Projects
- I must see your code for these by Tuesday September 16th. (Note: There is no more class time dedicated to these assignments)
Binary, Hex and Octal Numbers
Jeroo
Objected Oriented Programming Unit
After The Advanced Placement Exam
Other Interesting Links and Reading
Top
|