Question
Language: Java (20 pts.) - This assignment revisits the student parsing program from Assignment 7, but challenges you to restructure the component pieces of the
Language: Java
(20 pts.) - This assignment revisits the student parsing program from Assignment 7, 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) (10/20 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 age2
B) (3/20 pts.) When you instantiate your class with new, you must use the text file name (eg. People p = new People ("people.txt"))
C) (5/20 pts.) You are required to use Constructor, ArrayList and Overloading concepts.
D) Once your People.class is functional, generate a file Assg08_yourName.java. Assg08_yourName.java should contain only one Main() method.
[Example of Main()] public static void main(String[] args)throws FileNotFoundException { People p =new People("people.txt");
p.list(); // List of students AND teachers)
p.list("s"); // List of students
p.list("s","f"); // List of female students
p.list("s","f", 20); // 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 }
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
Contents of people.txt
s John m 18
t William m 42
s Susan f 21
s Jack m 19
s Jennifer f 18
t Sophia f 35
t Emma f 37
s Chloe f 17
s Rachel f 17
s Olivia f 26
t Ava f 59
t Tom m 47
s Mia f 18
s Isabella f 29
s Zoe f 17
s Lily f 20
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started