rendered paste bodyimport java.util.Scanner;public class UserActions implements UserInterface{ Scanner keyboard = new Scanner(System.in); //ReportBuilder theRock = new ReportBuilder(); public void consoleInteraction(ReportBuilder theRock){ { System.out.println("Enter M or m to see listings by major."); System.out.println("Enter D or d to see listings by dormitory."); System.out.println("Enter I or i to see a listing about an individual student."); System.out.println("Enter Q or q to quit."); char choice; choice = keyboard.nextLine().charAt(0); switch (choice) { case 'M': case 'm': displayByMajor( theRock.major, theRock.binaryStudentNumber, theRock.lastName, theRock.firstName, theRock.numberOfCredits, theRock.gpa); break; case 'D': case 'd': displayByDorm(theRock.major, theRock.binaryStudentNumber, theRock.lastName, theRock.firstName, theRock.age, theRock.dorm); break; case 'I': case 'i': displayByIndividual(theRock.textStudentNumber, theRock.firstName, theRock.lastName, theRock.dorm, theRock.major, theRock.age, theRock.numberOfCredits, theRock.gpa); break; case 'Q': case 'q': System.out.println("Goodbye."); System.exit(0); default: System.out.println("Invalid choice."); System.exit(0); } } }public void displayByMajor(String[] major, int[] textStudentNumber, String[] lastName, String[] firstName, short[] numberOfCredits, float[] gpa) { System.out.println("Which major do you want to see listings for?"); String majorSelection = keyboard.next(); if(majorSelection.equalsIgnoreCase("all")) { displayAll(theRock.major); } for (int count = 0; count < major.length; count++) { if(majorSelection.equalsIgnoreCase(theRock.major[count])) { System.out.printf("%s %s %s %d %4.2f\n", textStudentNumber[count], theRock.lastName[count], theRock.firstName[count], numberOfCredits[count], gpa[count]); } } }public void displayByDorm(String[] major, int[] textStudentNumber, String[] lastName, String[] firstName, short[] age, String[] dorm) { System.out.println("Which dorm do you want to see listings for?"); String dormSelection = keyboard.next(); if(dormSelection.equalsIgnoreCase("all")) { displayAll(theRock.dorm); } for (int count = 0; count < dorm.length; count++) { if (dormSelection.equalsIgnoreCase(theRock.dorm[count])) { System.out.println(textStudentNumber[count]); //theRock.lastName[count], theRock.firstName[count], theRock.age[count], theRock.major[count]); } }} public void displayAll(String[] major) { String[] majors = new String[20]; int[] counts = new int[20]; boolean exists = false; int majorsSoFar = 0; for(int count = 0; count < 120; count++) { for (int trackCount = 0; trackCount < majors.length; trackCount++) { if (major[count].equalsIgnoreCase(majors[trackCount])) { exists = true; counts[trackCount] = (counts[trackCount]) + 1; break; } exists = false; } if (!exists) { majors[majorsSoFar] = major[count]; counts[majorsSoFar] = 1; majorsSoFar++; } } for (int track = 0; track < majorsSoFar; track++) { System.out.println(majors[track] + " " + counts[track] ); } }public void quit() { // TODO Auto-generated method stub }public void displayByIndividual(String[] textStudentNumber, String[] firstName, String[] lastName, String[] dorm, String[] major, short[] age, short[] credits, float[] gpa) { System.out.println("Which student number do you want to see listings for?"); String studentSelection = keyboard.next(); for (int count = 0; count < dorm.length; count++) { if(studentSelection.equalsIgnoreCase(theRock.textStudentNumber[count])) { System.out.printf("%s %s %s %s %s %d %d %4.2f\n", textStudentNumber[count], theRock.lastName[count], theRock.firstName[count], theRock.dorm[count], theRock.major[count], theRock.age[count], theRock.numberOfCredits[count], theRock.gpa[count]); } }}public void displayAll() { // TODO Auto-generated method stub } }