Homework for the Holidays

You are going to write a class that will work with the Person class and a file. It will read in a first name, a last name, a gender, and 3 grades from a file and will then form a new instance of the Person class and will then place that instance into the ArrayList. There are 20 people in the file.

First, in BlueJ Create a new Project. Call in FileReaderProject. The open the Person class text file Here. Create a new class in BlueJ call it Person. Paste in information from the person class text file. Compile it.

Next - open the data.txt file Here. Save it as data.txt into the same folder where your Person class is (your file will be in the folder you created when you opened the new project - put it somewhere you can find it).

Next - open the filereader.txt file Here. Copy it. Form a new class in BlueJ - call it filereader - then paste the info from filereader.txt into it and compile it. You should then be able to create an instance of the filereader Object and call the reader method. This method should fill an array with 20 copies of the Person class. Look at the file reader program - try to see what is going on. 6 Strings are read in and 3 are converted to int and then a new Person object is constructed and put into the array (you do not have to know these methods for AP - no files, String to in conversion).

Once this is done try to create the following methods and add them to the filereader class
  1. public void printGirlsNames()
  2. public void printGirlsWhoPassedAllClasses()
  3. public void printBoysWithFailingAverage()
  4. public int countGirls()
  5. public int countPeopleOnHonorRoll() // avg >= 90
  6. public String getHighestGirl() // return name of girl with highest average
  7. public double getGirlsAverage()
  8. public double getBoysAverage()
  9. public boolean BoysAverageIsHigher() // return true if boys avg is higher otherwise false
    // don't rewrite code - call methods above