Question: *In JAVA* (can you screenshot the output too) Program Write a class called Student with 4 private instance variables first name, last name, age and
*In JAVA* (can you screenshot the output too)
Program
Write a class called Student with 4 private instance variables first name, last name, age and gpa. Write 2 constructors, 4 get methods, 4 set methods and a toString method.
Write a class, StudentListDriver with a main to do the following:
- read all the data from the StudentList.txt text file and put it into an ArrayList
structure which must be a static class member. Use a Scanner to read from the file using methods like next(), nextInt(), nextDouble() - Print the number of students in the ArrayList
- Print the student at index 100 in the ArrayList.
- Print and remove the student at index 57 in the ArrayList.
- Print how many students have a GPA between 3 and 4 inclusive.
- Print the student names only of those students whose GPA is between 2.5 and 3 inclusive.
- Delete the first student record with the name "Todd Novak"
- Print the student data from index 100 to the end.
5 of the parts above should be done by writing and then calling static methods:
readData for first part above
countBetween(lowerGpa, upperGpa) return the number of students in the ArrayList with a GPA between lowerGpa and upperGpa inclusive. Use an Iterator
printNamesBetween(lowerGpa, upperGPA) print names of students in the ArrayList with a GPA between lowerGpa and upperGpa inclusive. Use an Iterator.
deleteName(studentName) delete the first occurrence of studentName in the ArrayList. Use an Iterator.
printStudent(lowerIndex, upperIndex) print students in the ArrayList between the indexes lowerIndex and upperIndex inclusive. Do not use an Iterator.
Other Notes
- An ArrayList has similar indexing to an array it starts at 0 and ends at size -
- Set up the Scanner using the command
Scanner fileInput = new Scanner(new File("StudentData.txt"));
- Close the Scanner using the close() method.
- When setting up the Scanner, you will have to handle FileNotFoundException which is a checked exception. You can have the program quit (with an error message) if the exception occurs.
- You can set up the iterator by using the iterator method from the ArrayList class.
- You will need to read the Java API information for the Iterator
interface and ArrayList class.
----------------------StudentList.txt-------------------------------------
Molly Allen 18 1.77 Steven Martinez 24 0.55 Laylah Reynolds 19 0.47 Nicole Duarte 24 3.25 Immanuel Donovan 21 0.51 Bailee Whitehead 23 0.62 Brayden Newman 21 2.49 Clare Arroyo 19 2.5 Noah Melendez 22 1.68 Devyn Evans 24 3.12 Martha Mclaughlin 24 1.4 Emilia Ayala 19 0.16 Brendan Avila 22 2.27 Trystan Ramos 22 1.41 Yusuf Pham 22 1.91 Elizabeth Nguyen 23 2.8 Kash Christensen 21 1.8 Augustus Vincent 21 2.21 Christine Hayden 23 2.47 Gage Clark 21 2.91 Desirae Suarez 20 0.56 Lucia Reeves 24 3.66 Noe Wilkins 21 2.07 Aldo Choi 21 3.5 Teresa Burke 20 2.12 Cameron Hampton 22 2.36 Angelique Wyatt 22 3.92 Carlos Murphy 22 1.8 Romeo Myers 18 3.6 Marshall Beck 21 1.12 Angel Colon 23 2.76 Hugo Moore 19 3.56 Aaliyah Fisher 21 2.53 Taylor Golden 18 0.75 Amiah Hanna 23 1.59 Kaden Castillo 23 1.5 Keyon Briggs 18 2.82 Taniyah Mckenzie 18 3.5 Leia Clay 24 1.57 Amari Fowler 22 3.11 Johan Finley 18 2.61 Abdiel Grant 24 0.79 Kassandra Dudley 22 3.58 Lee Malone 23 0.21 Destiney Cardenas 22 1.17 Allisson Huynh 18 3.67 Kadin Lucas 23 1.08 Tyrese Daniels 24 0.23 Regan Roman 20 1.61 Tucker Acosta 24 2.28 Joshua Molina 20 0.4 Brock Marshall 24 1.59 Charles Foster 19 2.72 Dania Rocha 24 1.31 Peyton Garner 19 3.93 Audrey Rivas 18 2.72 Jaslene Perez 18 2.11 Kolton Cervantes 20 3.26 Rodolfo Burke 20 3.49 Reagan Vincent 18 3.04 Kole Travis 18 2.99 Mckinley Sosa 18 0.42 Abbie Bell 18 1.49 Jovan Sampson 22 0.06 April Guerra 21 1.64 Bryan Beasley 21 0.83 Skyler Vaughn 22 1.51 Brogan Christian 18 3.34 Cassidy Glass 21 1.19 Sebastian Rice 20 1.72 Annie Marks 22 1.23 Imani Haynes 21 0.91 Jeremiah Wyatt 18 3.48 Bridget Chambers 22 2.1 Bruno Hughes 19 3.25 Kenna Knapp 22 1.57 Gideon Lloyd 22 0.19 Jenna Banks 19 3.13 Cedric Fitzpatrick 18 2.8 Ariana Lowe 19 0.56 Atticus White 18 0.87 Zoe Becker 20 3.74 Phillip Orozco 23 2.11 Camilla Parker 24 2.76 Cherish Hood 22 2.37 Yoselin Ferrell 24 0.04 Jaydon Moran 21 1.54 Laila Marquez 19 1.93 Zion Thomas 18 0.58 Rosemary Monroe 24 0.96 Nickolas Armstrong 20 3.55 William Avila 22 2.94 Khloe Finley 18 2.98 Lizeth Wolfe 19 3.63 Adrian Hinton 20 2.11 Elianna Elliott 23 0.18 Guillermo Wall 18 1.77 Anika Macias 21 1.31 Winston Pruitt 19 0.6 Harper Bush 20 3.12 Kolten Massey 21 2.38 Bryan Riggs 21 2.69 Jenna Sullivan 20 2.57 Neveah Bridges 21 0.43 Wilson Ewing 21 1.2 Skyler Doyle 19 2.3 Makaila Savage 19 0.24 Todd Novak 20 1.12 Nikolas Gates 21 2.91 Rosa Waller 22 1.52 Sidney Salinas 22 1.83 Yasmine Orozco 23 1.53 Alissa Cross 24 2.07 Trevor Lin 21 0.81 Darion Fleming 19 2.18 Anton Bennett 21 3.36 Stephen Baird 18 3.93 Leonard Rush 21 3.84 Jaylen Schultz 19 3.21 Ansley Armstrong 23 3.92
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
