Lab 17: File I/O

In this lab we will practice file I/O. Work in pairs if you wish.

Problem

Write a Java program to read a file of the format shown in students.in (which is also shown below) into a database (the database in our case will be in the form of an array of Student objects):

    2
    John A. Doe
    1234
    CS
    3.64
    010-2342-4529
    Freshman

    Many Ann Jones
    1235
    AMS
    3.83
    010-3245-9879
    Sophomore
  
Above, the first line contains the number of records in the file. Each student record consists of six lines: name, ID, major, GPA, phone number, and class (year). There is a blank line between two adjacent records.

Once you read them into an array, you will want to process (modify) some information in each student record in the database. In this lab, let's change the class (year) from Freshman to Sophomore, from Sophomore to Junior, from Junior to Senior, and from Senior to Alum. Also add 0.01 to GPA if the student's major is ME.

Finally, let's write the processed (modified) student records in the database into a new file (students.out) using the same format that the input file used.

Make sure that your program works correctly. If you have difficulties, please get help during the lab and also outside the lab if you did not finish it in the lab.

When you are done...

Demonstrate to the instructor that your program works correctly.