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
-
public void printGirlsNames()
-
public void printGirlsWhoPassedAllClasses()
-
public void printBoysWithFailingAverage()
-
public int countGirls()
-
public int countPeopleOnHonorRoll() // avg >= 90
-
public String getHighestGirl() // return name of girl with highest average
-
public double getGirlsAverage()
-
public double getBoysAverage()
-
public boolean BoysAverageIsHigher() // return true if boys avg is higher otherwise false
// don't rewrite code - call methods above