Help with Java code

Associate
Joined
25 May 2006
Posts
13
Hi there,

Firstly, I'm new to Java and have very little experience - so apologies if this seems rather basic. I'm trying to write a programme in BlueJ that will allow me to output a table of multiplication values, the parameters of which can be entered when the method is called. Below is a (rather poor) example of what I mean.

1 2 ... 10
1 1 2 ... 10
2 2 4 ... 20
...
5 5 10 50

It's important that the table lines up correctly, which unfortunately these forums won't allow me to illustrate (the top line of numbers should be one space to the right).

I'm trying to teach myself Java from a book called 'Objects First with Java' with a few supplementary tuition lessons from a friend of a friend, but am finding it extremely difficult.

So far, this is the code I've written:

"public class MultiplyTables

{
private int accross;
private int down;

public void maketable(int accrossx, int downy)

{

int across = 1;
int down = 1;


while (accross <= 12)

{

}"

I think I need to use if/else statements but am having real trouble grasping all these different types of statement. Could anyone give me a hand with this?

Many thanks for any help.
 
Hi Protocol,

Thankyou very much for taking the time to do that - it is hugely appreciated. Rather than wasting more of your time, I will go through it myself (with the help of my trusty textbook) and will try to understand each section of your code. I may post back here if I run into trouble though - I'm finding it much like learning an entirely new language at the moment!

Thanks again.
 
Back
Top Bottom