Question
Need to create a program (Java) that makes use of an abstract data type (ADT), file input/output (I/O), classes & objects; Tasked with the responsibility
Need to create a program (Java) that makes use of an abstract data type (ADT), file input/output (I/O), classes & objects;
Tasked with the responsibility of reading in a list of students from a text file, creating a Student object for each student, pushing the Student object onto a Stack (ADT), and then providing an option to print the contents of the Stack by popping the students off the Stack one-by-one (You should print each Student on a separate line in the console see Sample Output). This program will be written in Java.
Program will be menu driven in which you will provide the following prompts to the user:
1. Load Students (From File)
2. Print Stack
3. Exit Program
We will assume the each student has the following data available:
First name
Last name
Address
o Address (Line 1)
o Address (Line 2)
o City
o State
o Zip Code
Student ID
GPA
Your program must contain at-least four (4) classes.
o Driver
o Stack
o Student
o Address
Your Stack (ADT) must be generic, thus allowing it to handle any type.
o You are NOT allowed to use the built-in Java Stack.
You should not print empty lines for example not every student will have an Address 2 (e.g., an apartment number), you should ignore these lines when printing out the Student.
The text file containing sample student data will be provided to you. The file will contain ten (10) students.
The format of the file will be as follows:
FirstName,LastName,StreetAddress,Address2,City,State,ZipCode,ID,GPA
Example Student:
Test,Testerson,123 Lane,Apt. 2,Indianapolis,Indiana,46220,123456789,3.75
Student file:
Florence,Forrest,1843 Glenview Drive,Apt. 2,Corpus
Christi,TX,78401,123456,3.215
Casey,Roberta,3668 Thunder Road,,Palo Alto,CA,94306,456789,2.978
Koch,Sandra,2707 Waterview Lane,Apt 302,Las Vegas,NM,87701,333555,2.546
Dover,Darrel,845 Dola Mine Road,,Wendell,NC,27591,124789,3.958
Turner,Doris,4489 Tully Street,Apt B,Detroit,MI,48219,564563,2.127
Hernandez,Juan,2656 Creekside Lane,,Goleta,CA,93117,576568,1.598
Moon,Sandy,1125 Joyce Street,,Mobile,AL,36693,709095,3.995
Reid,Andre,1225 Gnatty Creek Road,,Westbury,NY,11590,685544,2.985
Cracraft,Tara,3479 Austin Avenue,,Brunswick,GA,31520,567567,3.256
Valadez,Vincent,1740 Parkview Drive,,Sugar Land,TX,77478,000012,3.127
Below is example output of what your program should display when executed:
1. Load Students (From File) 2. Print Stack 3. Exit Program Enter Your Selection: 1
Students Loaded From File!
1. Load Students (From File) 2. Print Stack 3. Exit Program Enter Your Selection: 2
ID: 12 Name: Test Testerson Address: 1740 Parkview Drive Sugar Land,TX 77478 GPA: 3.127 ID: 567567 Name: Test Testerson Address: 3479 Austin Avenue Brunswick,GA 31520 GPA: 3.256 ID: 685544 Name: Test Testerson Address: 1225 Gnatty Creek Road Westbury,NY 11590 GPA: 2.985 ID: 709095 Name: Test Testerson Address: 1125 Joyce Street Mobile,AL 36693 GPA: 3.995 ID: 576568 Name: Test Testerson Address: 2656 Creekside Lane Goleta,CA 93117 GPA: 1.598 ID: 564563 Name: Test Testerson Address: 4489 Tully Street Apt B Detroit,MI 48219 GPA: 2.127 ID: 124789 Name: Test Testerson Address: 845 Dola Mine Road Wendell,NC 27591 GPA: 3.958 ID: 333555 Name: Test Testerson Address: 2707 Waterview Lane Apt 302 Las Vegas,NM 87701 GPA: 2.546 ID: 456789 Name: Test Testerson Address: 3668 Thunder Road Palo Alto,CA 94306 GPA: 2.978 ID: 123456 Name: Test Testerson Address: 1843 Glenview Drive Apt. 2 Corpus Christi,TX 78401 GPA: 3.215
1. Load Students (From File) 2. Print Stack 3. Exit Program Enter Your Selection: 3
Goodbye!
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