# Thread: arrays and multidimensional arrays

1. Member Join Date
Jun 2011
Posts
12
Rep Power
0

## arrays and multidimensional arrays

I have set an array of 8 students and then 8 multidimensional arrays of 3 for their results i got their average but have to display which students has the minumum average score ive no problem displaying the minum average mark but cant link it to the student array to get the student name into the output with there mark here is my method i be very thankful of some help

public void Min()
{
int[] max = new int; // allocates memory for 8 integers
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;
max= (marks + marks + marks)/3;

Arrays.sort(max);
System.out.println("The minimum score is = " + max);  Reply With Quote

2. ## Can you explain what the code you posted is supposed to do?
How does the the printed message at the bottom relate to the code?

Do you see the repeating pattern in the code? 0 1 2 3 ... thru 7
When you see that you should think: loop
Your code should have a loop instead of the 8 statements you have.

cant link it to the student array to get the student name
Are the arrays in parallel? The data for each student is at the same index in each array.
How do you get the index of the score that you are displaying? The code shows a constant index of 0 and not a variable.  Reply With Quote

3. Senior Member Join Date
Jun 2008
Posts
339
Rep Power
12

## Minimum average? what is that, and how is it calculated?  Reply With Quote

4. Member Join Date
Jun 2011
Posts
12
Rep Power
0

## sorry mate no how do you loop this, im using the three marks and am using an array of all the student marks and using array.sort to get the lowest average when you talk about parallel index this is my mistake could you demonstrated sorry very new to java  Reply With Quote

5. ## You can search on this forum for many examples of for loops.

If you sort the contents of an array, then you won't be able to use parallel arrays because the sorting process will remove the correspondence between the arrays. By correspondence I mean that the data at any index in all the arrays is for the same student. The scores[ix] would be for studentName[ix]  Reply With Quote

6. Senior Member Join Date
Jun 2008
Posts
339
Rep Power
12

##  Originally Posted by belfast09 sorry mate no how do you loop this, im using the three marks and am using an array of all the student marks and using array.sort to get the lowest average when you talk about parallel index this is my mistake could you demonstrated sorry very new to java
Sorry, I don't understand what you're saying. I was asking for an explanation of what the minimum average was and the algorithm for calculating it.  Reply With Quote

#### Posting Permissions

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