** Math Video Game! Play Fraction Balls!


A+    A−    B  
Home
Algebra
Math Games
Geometry
Private Tutors
Interactive
Trigonometry
Jobs
Teacher Resources

AddThis Social Bookmark Button

AP Computer Science

Advanced Placement Computer Science Page

Quick Reference of A Exam | AP Computer Science AB | C++ | netstat | my blog
    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'
    II. Searching
  • 3) p.338
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
Unit 4: ArrayLists and GridWorld ArrayLists
Links and Projects Homework
  • ArrayDemo.java
  • Array List API
  • Programming Project: PrimesFactory
  • Monday p.380 6.9 , p.382 6.7
  •  
    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
    Unit 2: Primitive Data, Objects & Review





    Unit 1 : Number Systems and CS Terms
    Objected Oriented Programming Unit
    Sorts Unit
    Recursion Unit
    Other Interesting Links and Reading

    Top
    AddThis Social Bookmark Button