Write a program to maintain a list of names with associated telephone numbers. Your user interface should appear like the one below:
The two JTextField allow you input the name and phone number. Initially, they are blank.
The three buttons behave as described below:
ADD a click on this button causes the "NAME" and "PHONE" you input is added to a list and the two textflieds are back to be blank.
DISPLAY a click on this button causes to print out all the values in the list in the terminal window. However, there are no two lines are identical. See the picture below:
QUIT a click on this button causes the terminal of the program. System.exit(0) will work.
HINTS:
Write a complete subclass of SimpleList named ListSet where the ‘add' method is overridden such that a ListSet will never contain duplicate items. The ListSet must use content equality to determine whether it contains an item. The ListSet ‘add' method will not ‘add' an item if the ListSet already contains the item and will return ‘false'. If the ListSet doesn't contain the item, then the ‘added' item is inserted as the last item in the ListSet and the add method returns ‘true'. In either case, the iterator is positioned at the end of the ListSet after the ‘add' method is executed.