Question: please help with this java assignment: Ken's office hours are getting really full, and a long line is forming outside his office each time. The
please help with this java assignment: Ken's office hours are getting really full, and a long line is forming outside his office each time. The students decide that they are too smart to simply line up and decide on implementing a system. The system is a queue, but with some weird exceptions. When a student joins the back of the line, if they are younger or if their grade is lower than the person in front of them they can move up spot, but only spot. Input If a student is joining the line, the input format is the student's first name then a space then their age, then a space, then their grade. When Ken helps the next student in line, removing them from the queue, the input is next. When the input is done, the input is end. Output The output will be the order of the students currently in line. If the queue is empty, output the word empty. Example Dale Christian Zane Esther next Ellis Ashley end Example Output Zane Esther Dale Ashley Ellis import java.util.ArrayList;
import java.util.Scanner;
public class kensOffice
public static void mainString args
Scanner inputnew ScannerSystemin;
ArrayListofficeLinenew ArrayList; array to store each student in line
whiletrue
String nameinput.next;
ifnameequalsnext
ifofficeLine.isEmptyto avoid errors
officeLine.remove;
else if nameequalsend
break;
else
int ageinput.nextInt;
int gpainput.nextInt;
ifnamelength
System.out.printlnStudent name must be less than characters";
break;
ifage
System.out.printlnStudent age cannot be more than years.";
break;
while gpa gpa
System.out.printlnStudent grade cannot be less than or more than ;
gpainput.nextInt;
Student studentnew Studentnameage,gpa;
officeLine.addstudent;
int iofficeLine.size;
ifi
Student presentStudentofficeLine.geti;
conditions to move up
ifstudentage
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
