I was learning Java and there was this exersize to construct a simple pyramid of prespecified height and width. The program i wrote is turining up with the wrong result. Any help would be much apreciated.
Knute Snortum wrote:Review where you use a = a - SOMETHING and where you use a = -SOMETHING, where "a" is any variable. Are the values really what you want?
Keep this in mind:
a = a - SOMETHING;
is the same as
a -= SOMETHING;
but not
a = -SOMETHING;
Yes. Got you.
But the program still doesnt work. Now there isnt a single rectangle on screen.
At this point I'd focus on getting one brick in the right place. Comment out the other code or start another program.
Then think about what is happening to x and y. x++ is to the right; x-- is to the left; y++ is up; y-- is down. Get two bricks in the right place, and so on.
Knute Snortum wrote:At this point I'd focus on getting one brick in the right place. Comment out the other code or start another program.
Then think about what is happening to x and y. x++ is to the right; x-- is to the left; y++ is up; y-- is down. Get two bricks in the right place, and so on.
Also, post your code.
Got the program to work. Weirdly it wasnt on the screen even in fullscreen but i had to scroll right to the bottom of the window where the pyamid was.
Your help was much appreciated thanks.
on a related topic, while working on programming a microcontrller i could debug the program line by line. Is it possible in eclipse too? Where can i find information about that. Thanks again.