CSPP50136 Prof. Adam Gerber Homework 4 (10 points) 1. Write a simple program that uses a HashSet to find and print duplicate words in an input stream (either prompt the user for a text file or user input from the console). (20 points) 2. Implement a Stack using java generics rather than upcasting to Object. You are free to choose the underlying data structure on which the Stack is built. Don't extend any existing Collections classes, just build the Stack from scratch, supporting the following typical Stack operations; push(), pop(), peek(). Include exception handling (i.e. have a few of the methods throw one or more exceptions when appropriate, for example trying to pop an empty Stack). Create a JUnit test to test the operations in your stack. (20 points) 3. Create a normal Java Driver class which tests the performance results of a) object insertions (add method) and b) object retrievals among Hashtable, ArrayList, and LinkedList. It is up to you to define a set of tests that sheds light on the underlying performance differences. This should include testing a range of collection sizes. Your program should produce a histogram of the test results. You may use a JUnit test here as well, but it is not required. (50 points) 4. Create a gui Blackjack game using WindowBuilder. Your gui should have a green table with player cards showing either up or down, and a label showing how much money the player has in the bank. Also, you will need buttons with which the player can interact. Here are some card images: http://www.jfitz.com/cards/ For instructions on how to play, see http://en.wikipedia.org/wiki/Blackjack The player should start with $1000 and bet a default $100 per round. Blackjack pays 1.5x. The game should implement the following features: Dealer must hit if his hand is less than 17. Aces are worth either 1 or 11. Dealer must hit on a soft-17. Player can Hit, Stand, or Double-down. Your game must play with a 6-deck shoe. You may use the source code from lecture03.tar called Console21 as inspiration, but keep in mind that this is not a GUI, nor has it implemented double-down or soft-aces (aces can be worth 1). You are not responsible for implementing multiple players, nor are you responsible for implementing split or insurance. (20 points EXTRA-CREDIT) 5. Create a simple java gui program using WindowBuilder similar to Bounce.java (from chapter 14) but which simulates the movement of multiple balls at once. The balls should bounce off of each other when they collide.