Java Arrays how do i fix this last project? - java application monitoring
Write an application that defines three groups:
Name - a set of 20 string variables. Each variable in this matrix is used to store the name of a person.
Age groups - a set of 20 integer variables. Each variable in this matrix is used to store a person's
Age.
GPA - a matrix of 20 variables of type double. Each variable in this matrix is used to store a person's
GPA.
2. "Load" of these three groups of values.
Tip: Create a loop that is executed will be 20 times. Each time through the loop, at a value for a variable in all three tables.
3. Matrices Sorted by GPA. In other words, put the person (name, age and GPA) with the highest GPA in the first variable in all three tables. Keep in mind that the discounts a mistake: The first element of each table has an index of 0
4. The sorted output result on the screen, which shows the GPA, the names and ages of each of the 20 people. He seemed to be quite good, so I began to surf the internet well now I'm confused!
[code]
java.util.Scanner import;
Public Class Three arrays
(
public static void main (String [] args)
(
Reader = new Scanner (System.in);
[INT] ages;
String [] names;
double [] AMP;
Age = new int [20];
names = new String [20];
GPA = new double [20];
int i;
to
(I = 0, i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; ages.length i + +);
) Ages [i] = readit.nextInt (;
System.out.println ( "Enter the object name");
) names [i] = readit.next (;
System.out.println ( "GPA");
AMP [double] = readit.next ();
)
)
[code]
1 comment:
So far, so good!
They have provided a problem here, as follows:
for (i = 0, i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; ages.length i + +);
I think you meant, so that (for example:
for (i = 0, i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; ages.length i + +) (
Then put the closing parenthesis after reading the APM. Can you give guidance on how to sort? The use of a particular algorithm?
In a real Java program, there is a single name, age and MAP in a class that extends the similar, create a picture of them, sort, then Array ().
However, there are three different elements, which are joined to be sorted manually (eg, the hard way) that, at all three as a unit.
Here are some sorting algorithms help you:
http://en.wikipedia.org/wiki/Selection_s ...
http://en.wikipedia.org/wiki/Bubble_sort
Post a Comment