the program instructions are:
Read a sequence of id numbers, telephone numbers and social security numbers into a two-dimensional array of 50 rows.
Each row in the array will contain an individual's id number, telephone number and SSN.
Do not read the input data from the keyboard.
Put a test file on the disk of atleast 15 rows and use it to test your program.
Sort the array rows into ascending id number order.
Then create a two-dimensional array where each row contains the social security number and the row index of the row which contains the SSN in the original array.
This array is referred to as the 'look -up table'
Sort the 'look-up table' in ascending order, based on the social security numbers(SSN).
Search the 'look-up table' for a social security number and retrieve the id number and telephone number of the person associated with the telephone number from the original array using the index number.
Write the search method so that multiple social security numbers can be accessed.
The text book that I am using is Java, An Introduction to Problem Solving & Programming - Walter Savitch
i have the following:
CODE
import java.util.*;
import java.io.*;
public class Lab6
{
int[]a = new int[30];
int mr;
mr = Class.read(a);
class (main1);
{
public static in read
(int[]x)x.length;
}
int[][]a = new int[30][3];
int nRows,numrows,numcols;
nRows=Class.read(a);
class(main2);
{
public static int read(int[][]x)
x.length=numrows;
x[]length=numcols;
}
count = Helper.read(a);
System.out.println("Data read in: ");
Helper.print(a, count);
Helper.sort(a, count);
System.out.println("Data sorted by ID: ");
Helper.print(a, count);
Helper.lookup(a, b, count);
//Helper.print(b, count);
Helper.sort(b, count);
System.out.println("Data sorted by SS w/ row index: ");
Helper.print2(b, count);
}
}
please tell me where i am wrong/right
thanks a lot