当前位置:以往案例 > >案例:CS案例之java案例Create a program that prompts for

Create a program that prompts for a student's name and student ID#.

Program will

– add name and id to a file

– continually prompt and add until user chooses to end adding names

– have a menu that:

–  displays current roster

– display will be sorted (you should change your code from earlier to sort the list and

THEN write to the file)

–  add students (repeatedly prompt for name/id until user chooses to stop)

–  find students (account for ID and for name (display name and ID when found)

– for name, if they pass in, for projectple, last name only, display ALL students that

contain that last name)

–  remove students (account for ID and for name)

–  quit (you will be calling a method here that writes the ArrayList to the file)

Each time a Student is created, it is added to the List in such a way that the List remains sorted by Student’s last name.  If multiple students have the same last name, then they’re sorted by first name.  If multiple students have BOTH the same last AND first names, they are sorted by ID.

Create a class, Student, which has-A String for the last name and first name (Last, First) and a String for the ID.

Create a class called IdCompleter, which has-A List of Students

– load the file into a List

– create a completeID method, which adds zeroes to the front of the ID IF there are less than 6 digits in the ID

– modify the file to include the updated IDs.


Use BufferedReader/FileReader class (or Scanner, like James Bond) to read from a file

and PrintWriter/FileWriter class  to write to a file



Idiot proof your code (re-prompt if enter a string instead of an int for id,

enter an id with too many numbers, etc)