NEED URGENT HELP IN HW!!!!!! PLZ HELP!!!! THNKZ - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

NEED URGENT HELP IN HW!!!!!! PLZ HELP!!!! THNKZ

s_pedros_pedro Posts: 8Member
//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[]?

list3 will be list1 and list2 joined, list3 will have 20 numbers....
Sign In or Register to comment.