Hi , I am totally new to Java . I need someone to provide this question with code answer so that I can learn from your code . Thank you.

Question 1 :

Store 20 integer employee ID numbers in an integer array and 20 corresponding employee last names in a String array. Use dialog boxes to accept an ID number, and display the appropriate name.

homework kiddo

Here is my code but need some modification
1. use dialog boxes

import java.util.Scanner; 
import javax.swing.*; 

public class EmployeeArray { 

public static void main(String[] args) { 

final int MAX = 20; 

Scanner keybd = new Scanner(System.in); 

int[] ID = new int[MAX]; 
String[] lastName = new String[MAX]; 

boolean found = false; 
int id = 0; 
int c=0; 

for (int i=0; i<MAX; i++) { 
System.out.println("Enter ID number: "); 
ID[i] = keybd.nextInt(); 
System.out.println("Enter last name: "); 
lastName[i] = keybd.next(); 
} // end for 

id = Integer.parseInt( JOptionPane.showInputDialog( "ID number?")); 

do { 
if (ID[c] == id) { 
found = true; 
} // end if 
} while (c<MAX); 

if (found) { 
JOptionPane.showMessageDialog( null, "Last name is "+lastName[c]); 
} else { 
JOptionPane.showMessageDialog( null, "Unknown ID: "+id); 
} // end if 

} // end main() 
} // end class EmployeeArray
This question has already been answered. Start a new discussion instead.