ASSIGNMENT 5
CLASSES + ARRAYLISTS + SCANNER + CONSTRUCTOR + OVERLOADING
" Do it yourself "
- Taesik Kim, Ph.D.
I ) (30 pts.) - This assignment revisits the student parsing program from previous practices, but challenges you to restructure the component pieces of the program to create a cleaner, more succinct Main(). You will generate a People class of object and load an ArrayList with person objects, then report the contents of that ArrayList. To do so, you must
perform the following:
A) (15/30 pts.) - Create a class file “People.java” (which will generate People.class upon compile). People.java will have eight(8) methods to
1) read a .txt file ‘people.txt
2) generate:
List of all students AND teachers
List of all students OR teachers
List of all female or male students OR teachers
List of female or male students OR teachers whose age is greater than or equal to given age
List of female or male students OR teachers whose age is greater than or equal to given age1 and less than given age2
List students OR teachers whose age is greater than or equal to given age
List students OR teachers whose age is greater than or equal to given age1 and less than given
B) (3/30 pts.) – When you instantiate your class with new, you must use the text file name (eg. People p = new People ("people.txt"))
C) (10/30 pts.) – You are required to use “Constructor”, “ArrayList” and “Overloading” concepts.
D) Once your People.class is functional, generate a file “Assg05_yourName.java”.
Assg05_yourName.java should contain only one Main() method.
[Example of Main()] This is an example. I will test all methods with deifferent values (teacher/student,
female/male, different age)
public static void main(String[] args)throws FileNotFoundException {
People p =new People("people.txt");
p.list();
p.list("s");
p.list("t","f");
p.list("s","f", 20);
// List of students AND teachers)
// List of students
// List of female teachers
// List of female students whose age>=20

p.list("s","f", 15, 20); // List of female students whose age>=15 and
age<=20
p.list("s", 20); // List of students whose age>=20
p.list("s", 15, 20); // List of students whose age>=15 and age<=20
}
(line break, 11 pt)
E) (2/ 30 pts.) - The main() method of Assg05_yourName.java may not contain more than 5 lines of code.
1 ) This total does not include comments and documentation
2 ) This total does not include statements mentioned at the above section A) 2).
F) (-10 pts.) - Include appropriate program documentation and formatting including:
1) Your first and last name
2) Your contact information
3) Your student ID number
4) The date
5) A short description of the program’s function
6) Comments necessary to explain the operation of your program
7) Proper indentation
(line break, 11 pt)
G) Save your file as “Assg05_yourName.java” and upload to Canvas. Also upload “People.java”.(line
H) If you used someone else’s code (part or full), you will get -150 points. In some cases, you will be asked to
explain to me how your program does work.
II ) A Sample log of execution is as follow :
*Note: No user inputs are a part of this assignment
public static void main(String[] args)throws FileNotFoundException {
People p =new People("people.txt");
p.list("s","f", 15, 20);
. . .
}
List of People
Type: Student, Gender: Female, Age: between 15 and 20
Susan
Olivia
Isabella
line break, 11 pt)