The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Description:
You will write a program that keeps track of a list of students and exposes a given set of choices with a menu. Do so by implementing at least two classes: Student and StudentApp
ad Student : The class Student represents a student. Notice that neither count nor sNumber are passed to the constructor. These two fields also have no set method (mutator). Hint: http://stackoverflow.com/questions/7221691/is-there-a-way-to-automatically-generate-getters-and-setters-in-eclipse
Sample Output :
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display the total number of students
6. Exit
Enter your selection: 4
A????1
S1234567 John Smith (CS) gpa:3.6
S1234568 Lauren Edwards (CS) gpa:3.8
S1234569 Alex Taylor (EE) gpa:3.2
A????1
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display the total number of students
6. Exit
Enter your selection: 1
A????1
First name: Rob
Last name: Hill
Major: ME
GPA: 3.4
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display the total number of students
6. Exit
Enter your selection: 2
A????1
Find student with sNumber S1234568
S1234568 Lauren Edwards (CS) gpa:3.8
A????1
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display the total number of students
6. Exit
Enter your selection: 3
A????1
Delete student with sNumber S1234569
S1234569 Alex Taylor has been deleted
A????1
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display the total number of students
6. Exit
Enter your selection: 2
A????1
Find student with sNumber S1234569
Student could not be found
ad count:
Notice that count is underlined. This indicated that count is a
static field.
Count keeps a running count of the Student objects that have
been created.
It is used to create a unique sNumber for each student
ad constructors:
The generated field sNumber needs to be initialized in both
constructors.
Create a unique 7 digit student number for each student based
on the static field count. (e.g. 1234567 + count++)
The parameterized constructor uses the values passed to
initialize the fields.
ad StudentApp:
StudentApp includes the main method .
Use private methods to structure your code.
If you want to add additional classes that is fine, too.
ad main
Create an ArrayList of students that is initialized with 3
different students.
Use a do-while loop and a switch statement to display a menu
with choices and to respond to the user selections.
Here is how the menu should look like:
1. Add a student
2. Find a student
3. Delete a student
4. Display all students
5. Display number of students in list
6. Exit
The user should not be allowed to enter a student number
because it is auto-generated.
If a user tries to find or delete a student based on a student
number that doesnA????1t exist, an appropriate message should be
displayed. (see output)
If a student is actually found or deleted corresponding student
data should be displayed as part of the response (see output)
1. Add a student 2. Find a student 3. Delete a student 4. Display all students 5. Display the total number of students 6. Exit Enter your selection: 4 A????1 S1234567 John Smith (CS) gpa:3.6 S1234568 Lauren Edwards (CS) gpa:3.8 S1234570 Rob Hill (ME) gpa:3.4 A????1 1. Add a student 2. Find a student 3. Delete a student 4. Display all students 5. Display the total number of students 6. Exit Enter your selection: 5 Number of Students: 3 A????1 1. Add a student 2. Find a student 3. Delete a student 4. Display all students 5. Display the total number of students 6. Exit Enter your selection: 6 A????1 Good bye
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll