Question: Complete the StudentInformation program below that makes use of parallel arrays and repeatedly provides the user with four different options until they choose to quit.
Complete the StudentInformation program below that makes use of parallel arrays and repeatedly provides the user with four different options until they choose to quit. Please see the Sample Program Output for how the program should work.
import java.util.*;
public class StudentInformation {
public static final int[] IDS = { 10001, 20890, 19010, 40978, 60983};
public static final String[] NAMES = {"Pamela", "Shriya", "Samuel", "Jevon", "Elisabeth"};
public static final String[] MAJORS = {"CSC", "MAT", "ECE", "CSC", "BUS"};
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
String option = "";
while (!option.equalsIgnoreCase("Q")) {
displayMenu();
option = scnr.next();
if (option.equalsIgnoreCase("L")) {
//Add code here
}
else if (option.equalsIgnoreCase("M")) {
//Add code here
}
else if (option.equalsIgnoreCase("I")) {
//Add code here
}
else if (!option.equalsIgnoreCase("Q")) {
//Add code here
}
}
//Add code here
}
public static void displayMenu() {
//Add code here
}
}
Sample Program Output:
$ java StudentInformation
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: L 10001 CSC Pamela
20890 MAT Shriya
19010 ECE Samuel
40978 CSC Jevon
60983 BUS Elisabeth
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: X
Invalid option
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: m
Enter major: CSC
10001 CSC Pamela
40978 CSC Jevon
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: M
Enter major: MSE
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: I
Enter id: 19010
19010 ECE Samuel
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: i
Enter id: 99999
Id not found
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: i
Enter id: abc
Invalid id
Student Information System - Please choose an option.
L - List All Students
M - Search by Major
I - Search by Id
Q - Quit
Option: q
Goodbye!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
