Results 1 to 13 of 13
- 06-21-2010, 02:55 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
- 06-21-2010, 03:11 PM #2
How can anyone help you if you don't know what is missing?i am missing a few elements. i dont know what they are
Please explain.
- 06-21-2010, 03:29 PM #3
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
how do you build a code that will calculate a 10 by 10 multiplication table. my code is incorrect.
i need someone who will help me
what do i do ?
- 06-21-2010, 03:34 PM #4
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
I think that you need to step away from posting all your homework on the forum and start studying your notes and texts because from all your posts it appears that you don't have a clue -- not even enough to understand the help that has been given you. This may seem cold and harsh but no matter how much help you get here, without serious study you will fail your course. There is no substitute.
- 06-21-2010, 03:37 PM #5
First you need to define what the output is to look like, line by line.
Then write a line of code to print the first line.
Then look at what must be changed to print the next line.
Continue until done.
-
hints:
1) Consider using nested for loops -- one inside of the other.
2) You can also use System.out.print(...) if you want to display something without creating a new line.
3) And yeah, study your notes and texts. We can answer questions, but only you can put knowledge into your head.
Much luck.
- 06-21-2010, 04:41 PM #7
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
- 06-21-2010, 04:44 PM #8
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
Most of us are self-taught, and no one is going to do this work for you, but fortunately, the net is more than enough. Please have a look at the Sun/Oracle Java tutorials: Learning the Java Language
If all you want is the answer, then go to rent a coder . com.please post the answer, someone
- 06-21-2010, 06:49 PM #9
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
loop inside a loop doesnt work. i tried something like that
class Ex5
{
public static void main(String[] args)
{
int count;
count=0;
while(count<10)
{
System.out.println(count+1);
count=count+1;
int count1;
count1=0;
while(count<10)
{
System.out.println(count1+1);
count1=count1+1;
}
}
}
}
-
1) Your inner loop is using the same loop variable, count rather than the new one, count1.
2) You're still using println where you should look into using print(..) as was suggeste above.
3) You really should read the tutorial on using for loops rather than while loops for this situation.
Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?
To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.
Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:
LuckJava Code:[code] // your code goes here // notice how the top and bottom tags are different [/code]
- 06-21-2010, 07:35 PM #11
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
okay , i am done. the matrix works. no need for another loop....
class Ex5
{
public static void main(String[] args)
{
int count;
count=0;
while(count<10)
{
System.out.println((count+1)+" "+(count+1)*2+" "+(count+1)*3+" "+ (count+1)*4+" "+
(count+1)*5+" "+(count+1)*6+" "+(count+1)*7+" "+(count+1)*8+" "+(count+1)*9+" "+(count+1)*10);
count=count+1;
}
}
}
- 06-21-2010, 07:39 PM #12
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
OK, now see if you can change your code simply to create a 12 x 12 matrix. And what if you want to have the code so that the user can input how big he wants the matrix to be? If you use nested for loops, this type of change can be done simply and easily by just changing one number.
Bottom line: if you want to do this assignment well, you'll use nested loops as suggested above. If you don't care, then just hand what you have in.
- 06-21-2010, 07:44 PM #13
Member
- Join Date
- Jun 2010
- Posts
- 26
- Rep Power
- 0
Similar Threads
-
Help with dox matrix printer
By Albert in forum Advanced JavaReplies: 7Last Post: 09-06-2011, 08:50 AM -
Scalability of matrix
By ajay kumar in forum New To JavaReplies: 0Last Post: 12-04-2009, 05:19 AM -
displaying 2D-Matrix
By srinivasmallabathula in forum New To JavaReplies: 2Last Post: 02-18-2009, 07:19 PM -
[SOLVED] Help with Matrix
By Bernard Robitaille in forum JCreatorReplies: 10Last Post: 02-14-2009, 02:19 AM -
Help with matrix
By susan in forum New To JavaReplies: 1Last Post: 08-07-2007, 04:37 AM


LinkBack URL
About LinkBacks


Bookmarks