My Project designs a generic singly linked list java class to hold objects of the generic type
IDE used: Eclipse
My program catches the error if the choice entered is not a number or is a number less than 0 and greater than 7 and throws an exception and asks the user to enter the choice unless the choice entered is not within the range.
It also tests for the inputs entered as magazine ID whether they are numbers and throws an exception if it is not a number.
Sample OutPut:
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 3
Enter Magazine ID: 1111 Enter Magazine Name: People Enter publisher Name: People Magazine Added
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 3
Enter Magazine ID: 1112 Enter Magazine Name: People1 Enter publisher Name: People1 Magazine Added
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: a Error: input must be a positive integer between 1 and 7 inclusive: 6
Magazine ID: 1112 Magazine Name: People1 Publisher Name: People1
Magazine ID: 1111 Magazine Name: People Publisher Name: People
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 4
Magazine Deleted Magazine ID: 1112 Magazine Name: People1 Publisher Name: People1
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 2
Enter Magazine ID: 1111 Magazine ID: 1111 Magazine Name: People Publisher Name: People
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 3
Enter Magazine ID: a Error: input must be a positive integer: Enter Magazine ID: 1 Enter Magazine Name: e Enter publisher Name: e
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 1
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 6
List is empty
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 3
Enter Magazine ID: 1113 Enter Magazine Name: People2 Enter publisher Name: People2 Magazine Added
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 2 Enter Magazine ID: 1113 Magazine ID: 1113 Magazine Name: People2 Publisher Name: People2
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 5
Enter Magazine ID to delete: 1113 Magazine Deleted Magazine ID: 1113 Magazine Name: People2 Publisher Name: People2
Operations on List
- Make Empty
- Find ID
- Insert At Front
- Delete From Front
- Delete ID
- Print All Records
- Done
Your Choice: 7
Done