Monday, March 31, 2014
APCS Test # 5 Review stuff
I have made a folder in Drive for the Test 5 review materials, including the keys.
Wednesday, March 26, 2014
APCS Quiz # 8 Free Response
//this
method will return the sum of all even numbers(except 8) in array
public
int evenSumMinusEight(int[] array)
{
int sum=0;
for(int i=0; i<array.length;i++)
{
if(array[i]!=8&&array[i]%2==0)
sum=sum+array[i];
}
return sum;
Write
the LotteryTicket method search(), as started below. search() will receive an
integer and determine if that integer is contained in the array instance
variable numberList.
Assuming numberList
contains [1,2,3,4,5,6,7,8,9.10]
The call search(34)
would return false
as
34 is not contained the list.
The call search(3)
would return true
as
3 is contained the list.
The call search(4)
would return true
as
4 is contained the list.
/** @param
val is a positive non-decimal value
* Precondition
: val >= 1 and val <= 50
* @return true if val is contained in numberList
*
@return false if val is not contained in numberList
*/
private boolean search(int val)
{
for(int item : numberList)
{
if(item
== val)
return true;
}
return false;
}
Tuesday, March 25, 2014
Assignments Update
There is an update in the Google Drive regarding everything that has been assigned throughout the semester in APCS.
Thursday, March 20, 2014
Free Response Hint for Friday's APCS Quiz
//this
method will return the number of numbers in array
//that
are less than the number 20
public
int lessThanTwentyCount(int[] array)
{
int count=0;
for(int spot=0; spot<array.length;
spot++)
{
if(array[spot]<20)
count++;
}
return count;
}
Thursday, March 13, 2014
Midterm Review Answers
Look here for answers for the Accelerated III midterm review. Good luck tomorrow!
Tuesday, March 11, 2014
Accelerated III Test # 4 Review
Ms. Erwin has graciously made a solution guide for the test review you worked on in class today. You can see it here. She said that number 1 is different on the guide than on the answer sheet.
Test on Wednesday!
Test on Wednesday!
Monday, March 10, 2014
Thursday, March 6, 2014
Accelerated III - URGENT!!!!!!!
Questions tomorrow will be asked
Under circumstances you are quite familiar with
In a paper and pencil kind of format
Zeroes will not be tolerated!
Find sin (3A) if A is in Quadrant I and cos A = 3/5. If you do this and give Mr. Lewis the answer, written down on paper, sticky note, etc., you can add 10 points to whatever it is we do on Friday...
Under circumstances you are quite familiar with
In a paper and pencil kind of format
Zeroes will not be tolerated!
Find sin (3A) if A is in Quadrant I and cos A = 3/5. If you do this and give Mr. Lewis the answer, written down on paper, sticky note, etc., you can add 10 points to whatever it is we do on Friday...
Wednesday, March 5, 2014
APCS Hint # 2
public void playGame()
{
Scanner keyboard = new Scanner(System.in);
int num = (int)(Math.random()*upperBound)+1, guess;
int guessCount=0;
do{
do{
System.out.print("Enter a number between 1 and " + upperBound + " ");
guess=keyboard.nextInt();
if(guess<=0||guess>upperBound)
System.out.println("Number out of range!");
}while(guess<=0||guess>upperBound);
guessCount++;
}while(guess!=num);
System.out.println("\nIt took " + guessCount + " guesses to guess " + num + " .");
double percent = (double)(guessCount-1)/upperBound;
System.out.println("You guessed wrong " + (int)(percent*100) + " percent of the time.\n\n");
}
{
Scanner keyboard = new Scanner(System.in);
int num = (int)(Math.random()*upperBound)+1, guess;
int guessCount=0;
do{
do{
System.out.print("Enter a number between 1 and " + upperBound + " ");
guess=keyboard.nextInt();
if(guess<=0||guess>upperBound)
System.out.println("Number out of range!");
}while(guess<=0||guess>upperBound);
guessCount++;
}while(guess!=num);
System.out.println("\nIt took " + guessCount + " guesses to guess " + num + " .");
double percent = (double)(guessCount-1)/upperBound;
System.out.println("You guessed wrong " + (int)(percent*100) + " percent of the time.\n\n");
}
Rock Paper Scissors
Hint:
public RockPaperScissors(String player)
{
int choice = (int)(Math.random()*3);
switch(choice)
{
case 0 : compChoice = "R"; break;
case 1 : compChoice = "P"; break;
case 2 : compChoice = "S"; break;
}
playChoice=player;
}
public RockPaperScissors(String player)
{
int choice = (int)(Math.random()*3);
switch(choice)
{
case 0 : compChoice = "R"; break;
case 1 : compChoice = "P"; break;
case 2 : compChoice = "S"; break;
}
playChoice=player;
}
Tuesday, March 4, 2014
Latest APCS Assignments
Here is what I believe are the up-to-date listings of the assignments for this semester in AP Computer Science. Feel free to check off what you have done. I am starting this process.
APCS Assignments
APCS Assignments
Subscribe to:
Posts (Atom)