Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Printing arrays from user inputs (2 dimensional)

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Printing arrays from user inputs (2 dimensional)

    Hi, I have a table of elements ( 2 dimensional arrays) . The user will enter in the name of the column and the value of the element in that column. There are 3 columns, how do I print out all the other values with their column's name on the same row? Thank you.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Printing arrays from user inputs (2 dimensional)

    user will enter in the name of the column and the value of the element
    How are names associated with the value of the indexes for an element in the array?

    Given a column index, is the program supposed to search the array to find the row that has the "value" in the given column?
    when you find the row, then you want to get all the values from that row except the one in the given column.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Printing arrays from user inputs (2 dimensional)

    Quote Originally Posted by Norm View Post
    How are names associated with the value of the indexes for an element in the array?

    Given a column index, is the program supposed to search the array to find the row that has the "value" in the given column?
    when you find the row, then you want to get all the values from that row except the one in the given column.
    so the table looks like this

    freshmen sophomore junior
    32 14 23
    31 23 45
    54 32 33.3
    80 13 0
    32 77 100

    If the user enter in: sophomore and a value of 14, I wants my program to display freshman = 32 and junior = 23

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Printing arrays from user inputs (2 dimensional)

    what have you coded so far?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Printing arrays from user inputs (2 dimensional)

    a

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Printing arrays from user inputs (2 dimensional)

    My program always print out the error statement
    You need to add the -Xlint option for the javac command to get the warnings from the compiler about possible problems with the code. Here is the commandline I use to compille the program:
    D:\Java\jdk1.7.0.7\bin\javac.exe -cp . -Xlint SeventhGradedAssignment.java
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 22
    Last Post: February 2nd, 2013, 08:16 PM
  2. Have user enter in 2 inputs instead of using -1 to end. Help appreciated!
    By neontiger in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 21st, 2012, 03:26 AM
  3. Help with 2 Dimensional Arrays
    By s1mmi in forum Object Oriented Programming
    Replies: 11
    Last Post: February 7th, 2012, 12:43 PM
  4. Replies: 1
    Last Post: September 28th, 2011, 07:29 AM
  5. Problem printing a two dimensional boolean array
    By sallyB in forum What's Wrong With My Code?
    Replies: 10
    Last Post: June 23rd, 2011, 03:56 PM