Skip to content

Practice Problem 10

Seanti edited this page Mar 26, 2025 · 1 revision

Problem:

Create a program that allows the user to:

  1. Add student names to an ArrayList.

  2. Remove a student by name.

  3. Display all students in the list.

  4. Use a loop to keep asking for actions until the user chooses to exit.


Sample Output:

1 - Add Student  
2 - Remove Student  
3 - Display Students  
4 - Exit  
Enter your choice: 1  
Enter student name: Juan Dela Cruz  
Student added!  

1 - Add Student  
2 - Remove Student  
3 - Display Students  
4 - Exit  
Enter your choice: 1  
Enter student name: Maria Santos  
Student added!  

1 - Add Student  
2 - Remove Student  
3 - Display Students  
4 - Exit  
Enter your choice: 3  
Students List:  
1. Juan Dela Cruz  
2. Maria Santos  

1 - Add Student  
2 - Remove Student  
3 - Display Students  
4 - Exit  
Enter your choice: 2  
Enter student name to remove: Juan Dela Cruz  
Student removed!  

1 - Add Student  
2 - Remove Student  
3 - Display Students  
4 - Exit  
Enter your choice: 4  
Exiting program.

Clone this wiki locally