Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Does anyone have any experience in Java pseudo-code that can help me work through a problem? I can write the code but can't figure out the logic behind it...

OpenStudy (kainui):

Yeah, I'm an expert in Java Pseudo-Code actually. I have a Pseudo-degree to prove it. What do you need help with?

OpenStudy (anonymous):

I have a table like this: * | 1 2 3 4 ------------------------ 1 | 1 2 3 4 2 | 5 6 7 8 3 | 9 10 11 12 that you get from user input like 'row' 'column' "'type of table'" (i.e. 3 4 "numbers"). I'm trying to figure out the pseudo-code for a times table (row*column), a sum table (row+column), an even numbers table, and a table that just prints 1 if none of those cases apply.

OpenStudy (anonymous):

I'm not really sure what you mean, but it kind of sounds like you want to make a 2 directional array of numbers, then you can do a for loop with 2 control values to hit every spot, and a function for each of your operations that takes 2 numeric parameters and returns the result of said operation on those numbers.

OpenStudy (anonymous):

Yeah, I think it's something like that...I've actually figured out the sum and times table through trial and error. Trying to figure out how to find and print out an even number through a loop

OpenStudy (anonymous):

To loop through a set of numbers and print the even ones? just do a for loop and check for a mod 2 of 0 for each

OpenStudy (anonymous):

How about printing a table like the example, except it's all 1s?

OpenStudy (anonymous):

all you have to do is a 2 dimensional array iterated through with a 2 variable for loop

OpenStudy (anonymous):

So keep the frame of the array the same and set the loop so the actually array just keeps printing 1?

OpenStudy (anonymous):

I'm not really certain what you're trying to do... if you're try to print a 2 dimensional grid of numbers (any numbers); a 2 dimensional array is a good way to do it; so the coordinates of the positions coincide with the indices of the array.

OpenStudy (anonymous):

* | 1 2 3 4 ------------------------ 1 | 1 1 1 1 2 | 1 1 1 1 3 | 1 1 1 1 Literally print something like this

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!