Exercise (Solutions)

E1

Write a method that takes a string from Scanner input and returns the number of unique characters in the string. It is expected that a string with the same character sequence may be passed several times to the method. Use Collection data structures to keep the list of strings that are given to the program and its unique characters. When the user enters 'Quit', the program should end and dump out all the results.

E2

Write a program which stores name and the list of telephone numbers that the name belongs to. User provides this from Scanner. If the user chooses to 'add' then the program adds a given contact number. If the user chooses to 'search', then the program takes the name as input and displays the telephone numbers stored for that name. A name can have many telephone numbers. Keep a data structure which can satisfy this requirement. If the user enters 'quit' the program ends.

results matching ""

    No results matching ""