I'm having serious trouble with this program.
I am supposed to create an application that allows the user to enter in a customer's account number, and should look-up a name and balance based on the account number entered in by the user. I have been given 3 lists of data (account numbers, names and balances) meant to be implemented into arrays.
Each array has 20 elements.
Here is what I have.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package accountsearch;
import java.util.Scanner;
/**
*
* @author Ian
*/
public class AccountSearch {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String [] name = new String[20];
double [] balance = new double[20];
int [] account = new int[20];
String tmp5pr;
System.out.println("Hello, please enter an account number.");
Scanner scanner = new Scanner (System.in);
int i = scanner.nextInt();
//declare array elements for array "name".
name[0] = "Abula";
name[1] = "Allen";
name[2] = "Austin";
name[3] = "Bailey";
name[4] = "Balovich";
name[5] = "Bates";
name[6] = "Bettencourt";
name[7] = "Blackburn";
name[8] = "Boucher";
name[9] = "Brown";
name[10] = "Duncan";
name[11] = "Estrada";
name[12] = "Fernandez";
name[13] = "Gallagher";
name[14] = "Gonzales";
name[15] = "Ha";
name[16] = "Hernandez";
name[17] = "Howard";
name[18] = "Johnston";
name[19] = "Nguyen";
// declare array elements for "balance".
balance[0] = 970.12;
balance[1] = 268.01;
balance[2] = 3821.94;
balance[3] = 3193.97;
balance[4] = 444.21;
balance[5] = 4253.79;
balance[6] = 2916.99;
balance[7] = 906.31;
balance[8] = 1291.99;
balance[9] = 2001.18;
balance[10] = 2963.20;
balance[11] = 1152.60;
balance[12] = 1113.05;
balance[13] = 3703.46;
balance[14] = 2667.88;
balance[15] = 3042.25;
balance[16] = 72.04;
balance[17] = 2229.66;
balance[18] = 3130.92;
balance[19] = 3004.99;
//declare array elements for "account"
account[0] = 7221379;
account[1] = 6853921;
account[2] = 4215534;
account[3] = 5551298;
account[4] = 6224649;
account[5] = 6502286;
account[6] = 8448936;
account[7] = 2883903;
account[8] = 6752376;
account[9] = 3564698;
account[10] = 6373150;
account[11] = 6375372;
account[12] = 8736368;
account[13] = 7218536;
account[14] = 6681985;
account[15] = 3909086;
account[16] = 5221192;
account[17] = 5901163;
account[18] = 2427821;
account[19] = 6331655;
}
}
I have been told that simply using while statements could help me at this point. I just do not know where to turn, any direction would be greatly appreciated.
Thanks!

New Topic/Question
Reply



MultiQuote








|