Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rolex54

macrumors 6502
Original poster
Aug 20, 2007
418
0
Houston, TX

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
You are seriously asking us to do your assignment for you? What do you expect to learn from us doing it?

You will be better off handing in what you have and learning from the constructive feedback you get...
 

rolex54

macrumors 6502
Original poster
Aug 20, 2007
418
0
Houston, TX
well what i need to do is draw that one in at least the 80 point version
The teacher gave us this formula to use
Start + n(total distance traveled/# of repetitions)
but every time i plug it in I am not getting anything like the picture in the instructions...

I have this so far
for(int x=0; x<60; x++)
{
g.drawLine(10,10,10+x*(630/60),640)
}
 

iShater

macrumors 604
Aug 13, 2002
7,027
470
Chicagoland
well what i need to do is draw that one in at least the 80 point version
The teacher gave us this formula to use
Start + n(total distance traveled/# of repetitions)
but every time i plug it in I am not getting anything like the picture in the instructions...

I have this so far
for(int x=0; x<60; x++)
{
g.drawLine(10,10,10+x*(630/60),640)
}

What are you getting?
 

rolex54

macrumors 6502
Original poster
Aug 20, 2007
418
0
Houston, TX
What are you getting?
this...
14o7io9.png
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Edit: Nevermind, not a caching problem. You're getting exactly what you want.

Look at your loop more. Write down the coordinates you want to get, and what you do get:
You are drawing from:
(10,10) to:
(10,640),
(20,640),
(30,640),
...
(600,640)

Is this what you want?

-Lee
 

rolex54

macrumors 6502
Original poster
Aug 20, 2007
418
0
Houston, TX
so what would I use to recreate this? (This is the task that is assigned in the lab sheet)
I don't know why he would give us that formula if it will not work to make this..
15pqzqv.png
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
http://www.mathsisfun.com/greatest-common-factor-tool.html
Or... math, will get you the GCD. Even without that, you just need to tweak your algorithm.

You're only moving where the line ends, not where it starts. You need to do both. I shouldn't be too bad. For one, you are starting in the upper left corner, (10,10). You need to start in the upper right corner, which is at (990,10). You may have to add and subtract to solve this.

Also, get off of the windows.

Use javac to compile your class on OS X from the terminal, then run:
appletviewer ./Lab05ast.html

Java is cross platform, and something like this does not require an IDE. When you get to the point of needing an IDE, there are others that are cross platform that you can use on OS X.

I don't know why he would give us that formula if it will not work to make this..

He gave you part of the solution, not the whole thing. It wouldn't be serving you if he did the legwork for you.

-Lee
 

iShater

macrumors 604
Aug 13, 2002
7,027
470
Chicagoland
Lee, you are too nice again. He should have figured out that 10x10 is the left upper corner. God help us when these students work for us in the 10 years. :eek: (Us as in our generation :eek: )
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Lee, you are too nice again. He should have figured out that 10x10 is the left upper corner. God help us when these students work for us in the 10 years. :eek: (Us as in our generation :eek: )

At least i didn't understand the coordinate system in awt and gave the wrong numbers. =) Er, maybe? I'm not even really sure yet.

-Lee
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Hooray, 100 pts for all!

I used to make these things in elementary school with a needle and thread on a piece of poster board. It was the only time anything I ever created "art-wise" made it to a show. It was displayed at the state capital (Juneau, Alaska) for a few weeks back in the late 60's. Who would have thunk 35+ years later, I'd be making them again, and this time a lot faster, and no sore finger from pushing the needle through.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.