The students' perspective from A. Philip Randolph's AP Computer Science class.
Thursday, March 24, 2011
Scope
Fibonacci
We also learned the fibonacci code and we did test preparation.
In the fibonacci code when using blue jay the computer recalculates the whole sequence to get the next value of the fibonacci code.
They add the first two index's to get the next index then recalculates all the index's to get the next sequence of the set.
Tuesday, March 22, 2011
Recursion and Palindromes
recursion
just trying to blog
What we learned in class today was about recursion, but it was at the last 10 minutes of class because all of us were doing the jumper project. From Mr. Jacoby recursion is a strategy for solving problems by
repeatedly reducing them to simpler problems.
For example: factorials
5! = 5 x 4!
4! = 4 x 3!
3! = 3 x 2!
2! = 2 x 1!
So from what i got the lower u go the more u can understand what is the answer.
Also that the repitition of it would eventually end it up being easier to do by that every time it recur it would repeat and then the simplest form and then from there go forwards then u should be able to get your answer.
Recursive problems are broken down into two cases
line 1. The base case: the simplest case where no computation is necessary.
line 2. The recursive case: everything else - brings us to closer to the base case. It simplifies or reduces the problem.
public int factorial(int n) {
line 1: if (n == 0) return 1;
line 2: return n * factorial(n ‐ 1);
}
All loops can be written recursively though its not a good idea!
Tuesday, March 15, 2011
INTERFACES!!!
Monday, March 14, 2011
computer science 3/14/11
Today's lesson in APCS was based on the pi day contest that the whole school goes through held by all of our known math teacher's Levy, Jacoby, Reisman, and others.
From our class, Omar managed to memorize 93 digits of pi (for what I dont know -__- lolz).
We also installed Eclipse, which like Blue Jay, is another coding "environment" for java. To install Eclipse, all you have to do is unpack the zip file download in the directory you want. When you unzip the file, it creates a subdirectory called "eclipse", with other subdirectories under that.
We got our tests back today, and you're like me who failed, you shouldn't worry about it to much because Jacoby curved the grade. So, take the grade you got on your test and find the square root of that and times it by 10, and that is your grade. Still failed...well try harder next time. =D
Tuesday, March 8, 2011
Test Review 2 plus some Blogspot fail
Firstly, today was super brief (lucky me) and we were refreshed on how an ArrayList works.
for example in ArrayList named List... Do you know what
List.add(x) means?
Well cause ArrayLists are more "Complex" than regular arrays so they have many different codes that remove and add variables to the Array.
Of wait getting ahead of myself now :)
List.add(x) meant that in the ArrayList of List , x was added/implemented to the end of the list. Although Mr.Jacoby didnt further explain this, to the end of the ArrayList did not mean it would literally go to the "end" but to the next space after a variable, if there was no variable inputted and x was the first, then it would be in the first.
Seems vague but most things are.
We were also refreshed on how to add a variable to an index in the ArrayList the code would be the same, a code demonstration would work out better...
List.add(1,5) <=This implements the second indeces, as we have to start counting by one, with the variable 5.
One thing what we have to keep in mind is that when an index is already being used and you add another variable to that indeces using this code, the remainder is shifted up the ArrayList.
so...
List{5,7,4,1}
List.add(1,3) <=the ArrayList will automatically shift the 7,4,1 up and the new array will be List{5,3,7,4,1}.
I NEED to finish off as I'm scared my blog will, or is taking up the webspace xD.
Extra notes>>>>>>>[ ] brackets means what you're declaring is an array,and ArrayList get larger by copying their current variables into a larger arraylist so the ArrayList space is endless and I'm guessing this wasn't so brief after all...-SANTIAGO
Monday, March 7, 2011
Look at that, test review (And random Tidbits of stuff from Fern :D )
Sunday, March 6, 2011
REACH Session #2
Friday, March 4, 2011
Polymorphism and abstract classes
}
a will be an object. The object can be Animal, Dog, or Cow. So if the object is cow, it will therefore call out "wassup?" If the Java virtual machine did not know the object, it wouldn't have done anything.
.....
An abstract class declares fields and abstract methods so that its subclasses can use them, but it represents an abstract idea that can't itself be instantiated. An abstract class need concrete subclasses to implement abstract methods. Concrete subclasses are specific. For example, an abstract class would be Car and a concrete subclass would be Move.
- I tried to explain as best as i could and i hope this helped.
Be sure to do Homework 18 (due Monday): GridWorld pg. 15 # 4 (dancing bug!!)
Reminder: We have REACH tomorrow!!....Note: The GridWorld assignment will be bonus for students who attend REACH.