Square root Loops

Posted 26 November 2008 - 04:29 PM

Below is what I've been working with but I'm having a difficult getting it to run and getting it to run correctly. Here are my instructions and this is what (in my mind) I was to do based on those instructions. Hopefully I just need to fix a few things here and there. Any help is greatly appreciated as always!

Quote

Write a program that displays the squares of the numbers from 1 to 10. Recall that the square of a number is just the number multiplied by itself. Demonstrate your knowledge of both looping structures by writing two procedures to do this. One procedure should be called, squareFor and the other should be called, squareDoWhile. Each procedure should take no arguments and return no values. Inside the procedure, simply display a message telling what kind of loop it is using and then use the appropriate loop to display the number, followed by its square.

When you finish writing these two procedures, write a main procedure that will call both squareFor and squareDoWhile to show that they work.

Although the output from your program is not required to look this way, it might look something like:

Re: Square root Loops

Posted 26 November 2008 - 05:27 PM

I was just getting ready to edit my post. I got to looking at this and thought, why the hell did I use an array? And it was due to the mass amounts of "Java Help" pages I had open and reading I ended up using one of there examples.

mostyfriedman, great that's what I was trying to do. I guess a big question of mine currently is why I kept getting errors on
public static void For() and public static void DoWhile() themselves? For my own learning, was I calling them wrong?