Problem 15
Use a HashMap to create a reusable class for choosing one of the 13 predefined colors in class Color. The names of the colors should be used as keys, and the predefined Color objects should be used as values. Place this class in a package that can be imported into any Java program. Use your new class in an application that allows the user to select a color and draw a shape in that color.
Problem 16
Write a program that determines and prints the number of duplicate words in a sentence. Treat uppercase and lowercase letters the same. Ignore punctuation.
Problem 19
Write a program that takes a whole number input from a user and determines whether it is prime. If the number is not prime, display its unique prime factors. Remember that a prime number's factors are only 1 and the prime number itself. Every number that is not prime has a unique prime factorization. For example, consider the number \(54 .\) The prime factors of 54 are 2,3,3 and 3\. When the values are multiplied together, the result is \(54 .\) For the number \(54,\) the prime factors output should be 2 and \(3 .\) Use Sets as part of your solution.
Problem 20
Write a program that uses a StringTokenizer to tokenize a line of text input by the user and places each token in a TreeSet. Print the elements of the TreeSet. [Note: This should cause the elements to be printed in ascending sorted order.