Well, I'm taking AP Java in school, which, if you aren't familiar with the AP program, is a college level course on Java programming. Our school is deprived of computer teachers, so our class is merged with a Java I class, the pre-requisite to AP Java.
What does this have to do with Arrays?
Well, since the Java I class knows relatively less than us, they need more teaching. Our teacher devotes almost 100 percent of his time to them. Which means when we got to arrays a week ago, we were lost.
We are still lost.
Can someone please explain how to implement arrays in Java? What we have gathered is that an array allocates memory and you determine numbers that go in each slot. I don't know how to utilize this for the program the manual wants us to develop.
The basis for this program is that the object, bug, moves within a grid as per commands given in the act section of the code. This program we need to code must make the bug 'dance,' turning the number of times in each successive number in the array and moving a set number of times in between turns.
Variables:
step
sideLength
Functions:
turn() - turns bug 45 degrees
move() - moves bug in direction it is facing
If you need any more info, I'd be happy to give as much as i know.
Gridworld?
Also:
[code]
int[] arrayofInts = new int[30];
[/code]
[editline]05:00PM[/editline]
You can make arrays with primitive datatypes as well as other classes, etc.
yes gridworld.
I've gotten that far. how do i make the bug turn() danceArray[0], move() 2, turn() danceArray[1]
What are you using for your GUI? Swing?
Also, are you manually rotating the bug or are you using different images to represent the bug in different positions?
Does the bug turn at a specific number in the array?
I believe the program uses swing.
Manual rotation.
The bug turns [i]x[/i] number of times, where danceArray[0] = [i]x[/i], for example.
For people who don't know Gridworld is AP way of testing if you understand object oriented idea. You extend bug, critter or some other thing to create new one that does what asked in the problem.
From what I can tell it is asking you do something like this....
[PHP]
for(int x=0;x< array.lenght;x++)
{
for(int y=0;y<array[x];y++ )
spin
other stuff here.....
}
[/PHP]
Oh boy. We didn't get into [B]for[/B] in Java I.
I'll see about this, see if it works.
[editline]06:52PM[/editline]
If it helps, [url=http://apcentral.collegeboard.com/apc/members/repository/ap06_CS_GridWorld_complete_101606.pdf]this[/url] is the manual. I'm on page 15.
[editline]06:56PM[/editline]
Hell, [url=http://www.horstmann.com/gridworld/]here[/url] is the page you get all the source code from.
[editline]07:01PM[/editline]
Okay, found the solutions guide. [url=http://apcentral.collegeboard.com/apc/members/repository/ap07_gridworld_solutions_doc_v2.pdf]Here[/url] it is if you want it. I would still like an explanation, but this will get me and my classmates through the section.
You shouldn't be touching Gridworld if you don't even know how to do for loops or arrays. :downs:
Get back to reading you book. Google is always your friend.
This is for an AP class. This is supposed to expand on what we learned in Java I. We were supposed to be prepared for this from our previous teaching. It's not my fault our teacher cannot handle a Java I class and AP, and it isn't his fault either.
I understand that it's for an AP class, I'm taking an AP Computer Science course now too. There are prerequisites to everything. These are things you need to know and you can't skip over. You shouldn't be asking for help now but reviewing and learning more material that will answer your questions. If you can't figure some of this out on your own without asking for help, you don't really need to be taking the course. I'm not trying to be an ass, I'm just being realistic here.
For loops and arrays go together like chips and salsa.
Damn them primitive arrays and their lack of set() and get() methods....
I don't even understand why we need to learn them for the AP test. ArrayLists are just so much easier.
[QUOTE=kevn150;19753507]For loops and arrays go together like chips and salsa.
Damn them primitive arrays and their lack of set() and get() methods....
I don't even understand why we need to learn them for the AP test. ArrayLists are just so much easier.[/QUOTE]
Um what? Why would arrays need set() and get() methods?
[QUOTE=tjl;19753633]Um what? Why would arrays need set() and get() methods?[/QUOTE]
It's just another way of looking at it. I think ArrayLists are better too. :buddy:
[QUOTE=andersonmat;19753665]It's just another way of looking at it. I think ArrayLists are better too. :buddy:[/QUOTE]
I don't see how it's "just another way of looking at it". They're the same thing really. It's just a dynamically-resizing array accessed using the List interface to make it more convenient.
[QUOTE=tjl;19753780]I don't see how it's "just another way of looking at it". They're the same thing really. It's just a dynamically-resizing array accessed using the List interface to make it more convenient.[/QUOTE]
You just told me how it was another way of looking at the same thing. :saddowns:
[QUOTE=andersonmat;19753432]I understand that it's for an AP class, I'm taking an AP Computer Science course now too. There are prerequisites to everything. These are things you need to know and you can't skip over. You shouldn't be asking for help now but reviewing and learning more material that will answer your questions. If you can't figure some of this out on your own without asking for help, you don't really need to be taking the course. I'm not trying to be an ass, I'm just being realistic here.[/QUOTE]
My point is that what the hell should[I] the entire AP class[/I] do?
wow that's AP computer science? looks like a normal OOP exercise that you can learn in a day.
[QUOTE=Xama;19758910]wow that's AP computer science? looks like a normal OOP exercise that you can learn in a day.[/QUOTE]
Pretty much.
Your class is screwed for the AP test.
[QUOTE=WastedJamacan;19751031]Oh boy. We didn't get into [B]for[/B] in Java I.[/QUOTE]Oh my god, what else could you have been possibly doing the WHOLE year of Java I that didn't give you time to learn something as important as that? Oh my god.
Sorry, you need to Log In to post a reply to this thread.