I'm currently having some serious issues with my comp sci assignment. I don't really understand how to read and write to a file and need help. Here are the instructions to the assignment.
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 program
Create a class, Student, which has-A String for the name (Last, First)
and a String for the id
Create a class called IdCompleter,
which has-A (HLY2)List/(SL)Array of Students
load the file into a (HLY2) List or (SL) Array
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 to read from a file
and PrintWriter(FileWriter) class to write to a file
(LOOK THEM UP)
********************************************************************
Extension to the plan:
Create a menu with the following options:
1) display current roster (loads file and prints the current list of students and IDs)
- display will be sorted (you should change your code from earlier to
sort the list and THEN write to the file)
2) add students
3) find students (account for ID and for name (display name and ID when found)
- for name, if they pass in, for example, last name only, display
ALL students that contain that last name)
4) quit
Idiot proof your code (re-prompt if enter a string instead of an int for id,
choose menu item option that doesn't exist, enter an id
with too many numbers, etc)
Can somebody help me?
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 program
Create a class, Student, which has-A String for the name (Last, First)
and a String for the id
Create a class called IdCompleter,
which has-A (HLY2)List/(SL)Array of Students
load the file into a (HLY2) List or (SL) Array
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 to read from a file
and PrintWriter(FileWriter) class to write to a file
(LOOK THEM UP)
********************************************************************
Extension to the plan:
Create a menu with the following options:
1) display current roster (loads file and prints the current list of students and IDs)
- display will be sorted (you should change your code from earlier to
sort the list and THEN write to the file)
2) add students
3) find students (account for ID and for name (display name and ID when found)
- for name, if they pass in, for example, last name only, display
ALL students that contain that last name)
4) quit
Idiot proof your code (re-prompt if enter a string instead of an int for id,
choose menu item option that doesn't exist, enter an id
with too many numbers, etc)
Can somebody help me?