-
Notifications
You must be signed in to change notification settings - Fork 0
Practice Problem 11
Seanti edited this page Mar 26, 2025
·
1 revision
Create a program that:
-
Stores student names as keys and grades as values in a
HashMap. -
Allows the user to add students with grades.
-
Allows the user to retrieve a student's grade by entering their name.
-
Allows the user to remove a student from the list.
-
Uses a loop to keep asking for actions until the user chooses to exit.
1 - Add Student and Grade
2 - Get Student Grade
3 - Remove Student
4 - Display All Students
5 - Exit
Enter your choice: 1
Enter student name: Pedro Reyes
Enter grade: 88
Student added!
1 - Add Student and Grade
2 - Get Student Grade
3 - Remove Student
4 - Display All Students
5 - Exit
Enter your choice: 1
Enter student name: Anna Cruz
Enter grade: 95
Student added!
1 - Add Student and Grade
2 - Get Student Grade
3 - Remove Student
4 - Display All Students
5 - Exit
Enter your choice: 2
Enter student name: Anna Cruz
Anna Cruz's grade: 95
1 - Add Student and Grade
2 - Get Student Grade
3 - Remove Student
4 - Display All Students
5 - Exit
Enter your choice: 3
Enter student name: Pedro Reyes
Student removed!
1 - Add Student and Grade
2 - Get Student Grade
3 - Remove Student
4 - Display All Students
5 - Exit
Enter your choice: 5
Exiting program.