Saturday
December 20, 2014

Homework Help: Computer Science

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

Answer this Question

First Name:
School Subject:
Answer:

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 Panel Problem - I am supose to draw a grid and center it with a 10 pix ...
Computer Science - Consider the following application files: /JavaCS1/src/...
Java programming - can you show me where is the wrong for this program..because ...
Computer Science - The digits 0, 1, and 8 look much the same if rotated 180 ...
programming - Can anyone help me with this really confusing programming problem...
Java programming- simulation of rolling dice - This is what i have so far. I'm ...

Search
Members