Nigel Nisbet Guest
|  | AP computer science « Thread Started on Nov 10, 2005, 7:59pm » | |
Hi everybody, please feel free to use this board to post any questions, discussions (frustrations), successes connected to AP computer science in the LAUSD
| |
|
Guillermo Guest
|  | Re: AP computer science « Reply #1 on Jan 3, 2006, 11:47pm » | |
Are we supposed to post under this thread or create new threads in the General Board ( http://lausdapcs.proboards79.com/index.cgi?board=general ) because i created a new thread in the General Board section but I there aren't any responses...
| |
|
Mr Nisbet Guest
|  | Re: AP computer science « Reply #2 on Jan 4, 2006, 3:30pm » | |
Hi Guillermo
Thanks for notifying me here, I don't always check the other boards so the best thing to let me know if you've got an issue is to leave a simple message on the student board (the one you used before) we can then create trhreads and use the computer science one as necessary
| |
|
Arpan Patel Guest
|  | Re: AP computer science « Reply #3 on Jan 7, 2006, 11:54pm » | |
Hey Mr. Nisbet, I am having trouble with most of the Chapter 2 Questions (Marine Biology Case Study). What should i do if i can't answer them?
| |
|
Mr Nisbet Guest
|  | Re: AP computer science « Reply #4 on Jan 8, 2006, 1:42pm » | |
Hi Arpan,
All I really want to do is read ch1 and ch2. If you can't answer the questions don't worry - just make sure you prpint out a copy for yourself (be prepared it's over 100 pages) and we'll start looking at it this week.
See you tomorrow
| |
|
Arpan Patel Guest
|  | Re: AP computer science « Reply #5 on Jan 8, 2006, 3:44pm » | |
Thnx
| |
|
Arpan Patel Guest
|  | I need HELp!!! « Reply #6 on Jan 29, 2006, 1:12am » | |
hey mr nisbet
I had a question about Chpt2 pg40 analysis Question set 8, #2. I still don't quite understand how to keep track of the fish's age. Can you give me some tips.
thnk you
| |
|
Mr Nisbet Guest
|  | Re: AP computer science « Reply #7 on Jan 29, 2006, 12:05pm » | |
HI Arpan
Thanks for your great question. This is exactly the type of complicated task you should be focussing on and is great preparation for the AP exam.
Ok here's the deal.
First things first, you need to add a new variable to the initialize method in the Fish class called <-- myAge --> (or something like it). This variable must get set to zero when the fish is initialized.
So now every time a new fish is constructed, the constructor calls the initialize method and sets up all the variables including your new one <-- myAge --> so now the fish has an age.
Now we have to figure out how the fish gets older every time the program runs thourgh a single timestep.
Every time the program runs through 1 timestep several things happen you can take advantage of. Inside the (GUI) or ant test main method you call upon the simulation class to take a step like this - <-- sim.step(); -->;
Inside the simulation class calls upon all the fish to act like this <-- f1.act(); --> [assuming there is a fish called "f1"]
Now the act method inside the fish class calls the move method of the fish like this <-- move(); -->
I would suggest that somewhere even in the act or move methods you add one to the age variable for the fish - something along the lines of <-- myAge++; -->
The means that every time the fish gets called to act ( which happens once per timestep) its age increases by one.
See if you can get this to work, and seeing as how I won't see you until Wednesday fell free to ask me any more questions here.
Have a good weekend
Mr. Nisbet
| |
|
Arpan Guest
|  | Re: AP computer science « Reply #8 on Jan 30, 2006, 8:05pm » | |
sry mr. nisbet
| |
|
arpan patel Guest
|  | Re: AP computer science « Reply #9 on Jan 30, 2006, 8:07pm » | |
sry mr.nisbet
i had another question. how can you convert something that prints out like this java.awt.Color[r=255,g=0,b=0] to something like red 
| |
|
Mr nisbet Guest
|  | Re: AP computer science « Reply #10 on Jan 30, 2006, 10:17pm » | |
Hi Arpan
believe it or not
java.awt.Color[r=255,g=0,b=0]
is actually red.
what its saying is this is a Color code with red=255(the highest), green=0(none), blue=0(none)
All colors in java, or in fact any computer are made up by a mixture of red, green and blue. So [r=255, g=255, b=255] would be balck and [r=0, g=0, b=0] would be white etc.
So if your printing out the color and expecting red, then that's exactly what you're getting with
java.awt.Color[r=255, g=0, b=0]
I hope this helps.
by the way what's sry?
| |
|
Arpan PAtel Guest
|  | Re: AP computer science « Reply #11 on Jan 31, 2006, 8:31pm » | |
hey Mr.Nisbet
r we gonna have time in class to finish Cpht.2?
thnx
| |
|
Mr Nisbet Guest
|  | Re: AP computer science « Reply #12 on Jan 31, 2006, 11:22pm » | |
yes, absolutely
see you tomorrow
Mr. Nisbet
| |
|
arpan patel Guest
|  | Re: AP computer science « Reply #13 on Feb 12, 2006, 5:11am » | |
hey mr.nisbet
i had a question about the baseball exercise for hw.
in order to print out the postion or game of the min and max runs, what i did was make a variable max game and made it equal to 3 and i made another int variable and made it equal to 1.
then here is the other part of code that i put in,
int maxgame = 3; int mingame = 1; int[] scores = {2,1,3,0,2,1,4}; for(int i = 0; i < scores.length; i++) { totalruns = totalruns + scores[i]; if (scores[i] > maxruns) maxruns = scores[i]; if (scores[i] < minruns) minruns = scores[i]; if (scores[i] > maxgame) maxgame=i; if (scores[i] < mingame) mingame=i;
The problem is that when i print out max game, i get 6 which i think is te right answer, but for min game i also get 6 which is wrong because the lowest scoring game should be on position 3. i don't get why this happens?
Is there a special array method in which you could input ints or char's and it tells you their postion?
thnkx
| |
|
dddddddd Guest
| |