Write a threaded Java applet that displays an animated boat race between at least three boats on 1 "course".
For this assignment you will build upon the last assignment and the midterm boat design question. You will use a thread to help build an animation--building upon the race applet you did in Assignment 2. The racers will be boats according to the classes in the UML diagram below, you should extend CCompetitor in homework 2 solution to facilitate this (i.e. CBoat extends CCompetitor). You will use the class diagram as a guide to creating your classes (you may need to add some methods and/or variables). Your boats will race from the top of the applet window to the bottom. Once the winner reaches the bottom of the applet window you will alert the user with a victory message stating the winner.
The velocity of a boats depends on the total horsepower of all its motors (if any), and the total height of all its masts (if any) and windspeed (don't worry about wind direction). Windspeed is fixed at 10 units (or knots if you prefer).
Velocity = (10% of total horsepower + 10% of ( total mast heights * windspeed )) units per second.
- You must use the files in the hw2soln.zip (solution to Assignment 2) as the basic starting framework for your project;
- You must include one collection type object (vector, List, etc.) that contains your sprites;
- You must have 1 course and at least 3 boats of different configurations of propulsion devices (no rowboats);
- Your applet must implement Runnable (i.e. use the thread interface) and sleep for an appropriate number of milliseconds, whereupon it calculates the new positions of the boats, draws the course--which is an ocean represented by randomly placed tilde characters [~] for waves--and last, draws the boats;
- A boat is to be represented by Rn (for rowboats, which actually shouldn't be present) if it has no engines or masts, Sn if it has mast(s) but no engines, Mn if it has engine(s) only, and Hn if it's a hybrid (i.e. has mast(s) AND engine(s)), where n is a unique single digit number for the boat.
- Note that both CMast and CEngine have no set methods. What does this tell you about their design?
- The random ~ for waves on the ocean must be randomly drawn each time the CCourse object draws itself, so you may want to incorporate the random placement within the draw method of CCourse.
- Use g.drawstring to draw the various characters necessary (don't use images).
- You must follow good coding standards as described in the early class notes (points will be deducted for insufficiently commented code, poor indentation, cryptic abbreviations, lack of or inadequate function headers (see samples in zip file's code), etc.)
- And, of course, you will be graded on good design of your classes (pay special attention to the principles discussed in class).
- Your project must run with JCreator from one directory (you are free to debug with other IDEs but must submit in JCreator format).
- Your project MUST be in a zip file as below, and MUST extract into a directory named as your LASTNAME_FIRSTNAME.
- +2 points extra credit for consistent use of hungarian notation.
- +5 points extra credit for having wind speed vary randomly from 0 knots to 30 knots.
Updated November 5, 2003