Posted by Pedro on Thursday, October 1, 2009 at 12:28pm.
//program that puts two lists in order in one single list with all the numbers in order
import java.util.Scanner;
public class listOrder {
public static void main (String [] args){
int [] list1;
int [] list2;
int [] list3;
int temp;
list1 = new int [10];
list2 = new int [10];
list3 = new int [20];
for (int i = 0; i < 10; i++)
{
list1[i] = (int) (Math.random () * 100)+1;
}
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 10; i++)
{
if (list1[i] > list1[j])
{
temp = list1[i];
list1[i] = list1[j];
list1[j] = temp;
}
}
}
for (int i = 0; i < 10; i++)
{
System.out.print(" list1[" + i + "] = " + list1[i] + " / ");
}
System.out.println (" ");
for (int i = 0; i < 10; i++)
{
list2[i] = (int) (Math.random () * 100)+1;
}
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 10; i++)
{
if (list2[i] > list2[j] )
{
temp = list2[i];
list2[i] = list2[j];
list2[j] = temp;
}
}
}
so i got these two lists... how do i join them in list3[]?
they are already worked in a way so the get in order from least to greatest...
list3 will have the numbers from list1 and list2, joined will be 20 numbers....
plz help me, thanks
No one has answered this question yet.
Answer this Question
Related Questions
Computers - //program that puts two lists in order in one single list with all ...
Java help please - I am trying to run the following program and am getting this ...
Computer Science-Java - Hi, I am writing an application class for a Lunar ...
Computer Science Computer Programming - Please help! I cannot figure out what I ...
Java programming - can you show me where is the wrong for this program..because ...
programming - Can anyone help me with this really confusing programming problem...
Computer Science - Consider the following application files: /JavaCS1/src/...
Computer Science - The digits 0, 1, and 8 look much the same if rotated 180 ...
java - Write a menu driven program that either accepts words and their meanings...
Computer Science JAVA FUNCTIONS - Write a Function You will be given one of the ...
For Further Reading