Hello. I am currently working on making a multiplication table where you enter in your own dimensions. I managed to get the prompt to work, but whenever I enter in my own numbers I am unable to get my desired result. Also, I'm slightly new to Java. Here is what code I have so far:
zeroeth...Welcome to the Ranch! Hopefully we'll be able to help you. to that point...
First, we have no idea what your 'desired result' is, so it would help if you clarify.
Second, since you know what this DOES do, it would help if you told us. does it compile? Does not start? does it start to run and die? Does is run and give the wrong output? what would that output be?
third, you should never get this far. NEVER write more than 2-3 lines of code before you compile and test. Do you know if your input is being processed correctly? Do you know if your loops are running the correct number of times? etc.
fourth...the best way to see what's going on is to stick a ton of System.out.println statements in there to see where it is going.
fifth...this is wrong:
There is something in there that is causing your loop to not do what you think it is...it is running, but it is not doing anything terribly useful.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
one error is the same as the other loop. this is the entire loop statement due to your error. what you think is the body of the loop actually isn't.
also, you set maxcol to 1, test to see if it is less than col. You then increment col. so, if maxcol is less than col, it will be less than col +1, +2, +3, etc., until col rolls over the integer max and becomes the integer minimum, and negative.
Joined: Sep 26, 2011
Sorry about the late reply.
The desired output should look something like this: