Results 1 to 13 of 13
  1. #1
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default how do i build a 10*10 multiplier table(matrix)?

    i tried to create a code, but i am missing a few elements. i dont know what they are!


    class Ex5
    {
    public static void main(String[] args)
    {
    int count;
    count=0;
    while(count<9)
    {
    System.out.println((count+1)*(count+1));

    count=count+1;
    }

    }




    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    i am missing a few elements. i dont know what they are
    How can anyone help you if you don't know what is missing?
    Please explain.

  3. #3
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    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 ?

  4. #4
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    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.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    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.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    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.

  7. #7
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    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.
    babes, it is my 3rd lesson. i have no books, all i have is the net. i cant do a while inside , a while, .. no one has taught me that.

    please post the answer, someone

  8. #8
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by Libertyman View Post
    babes, it is my 3rd lesson. i have no books, all i have is the net. i cant do a while inside , a while, .. no one has taught me that.
    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

    please post the answer, someone
    If all you want is the answer, then go to rent a coder . com.

  9. #9
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    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;
    }
    }

    }




    }

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    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 [cod&#101;] above your pasted code and the tag [/cod&#101;] below your pasted code like so:

    Java Code:
    [cod&#101;]
      // your code goes here
      // notice how the top and bottom tags are different
    [/cod&#101;]
    Luck

  11. #11
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    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;
    }

    }




    }

  12. #12
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by Libertyman View Post
    okay , i am done. the matrix works. no need for another loop....
    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.

  13. #13
    Libertyman is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by curmudgeon View Post
    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.
    it is my 3rd lesson. The teacher is not interested in short code..he is interested in an answer. we studied using one loop, and i didn with one loop

Similar Threads

  1. Help with dox matrix printer
    By Albert in forum Advanced Java
    Replies: 7
    Last Post: 09-06-2011, 08:50 AM
  2. Scalability of matrix
    By ajay kumar in forum New To Java
    Replies: 0
    Last Post: 12-04-2009, 05:19 AM
  3. displaying 2D-Matrix
    By srinivasmallabathula in forum New To Java
    Replies: 2
    Last Post: 02-18-2009, 07:19 PM
  4. [SOLVED] Help with Matrix
    By Bernard Robitaille in forum JCreator
    Replies: 10
    Last Post: 02-14-2009, 02:19 AM
  5. Help with matrix
    By susan in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 04:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •