# Printing arrays from user inputs (2 dimensional)

• March 11th, 2013, 12:54 PM
kevinsauerzxc
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.
• March 11th, 2013, 01:03 PM
Norm
Re: Printing arrays from user inputs (2 dimensional)
Quote:

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.
• March 11th, 2013, 01:11 PM
kevinsauerzxc
Re: Printing arrays from user inputs (2 dimensional)
Quote:

Originally Posted by Norm
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
• March 11th, 2013, 01:20 PM
Norm
Re: Printing arrays from user inputs (2 dimensional)
what have you coded so far?
• March 12th, 2013, 09:18 PM
kevinsauerzxc
Re: Printing arrays from user inputs (2 dimensional)
a
• March 13th, 2013, 07:28 AM
Norm
Re: Printing arrays from user inputs (2 dimensional)
Quote:

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: