Default
Google

Hampshire Gold Cup !

This applet was my entrance examination on "Java Programming" course that was organized by VDI company. If you are interested in your Java upgrading, have a look at this test - just to estimate your ability to pass the entrance exam. They asked me to do the folowing task in 48 hours.

The text below is my free translation from Russian. Should anyone want an original version - write me.


Entrance Examination - Cockroach Races

Main task

This task is the immitation of Cockroach Races. This program should be implemented as applet or frame that should be loaded from applet. Applet should contain N traces (one for each cockroach). All race trackes should be numbered and the number of cockroach must be in correspondence with the number of its race track. The total number should be passed to applet as the parameter. There must be finish line at the end of each race track. All races should have end-to-end numeration. The Start button must be placed for the beginning of new race. Every cockroach should be drawn as oval with 8 feet, or an image loaded from gif file. Every cockroache must run in its own race track.
Every cockroache must be implemented as separate thread - the instance of cockroaches common class that implements inteface Runnable. Moving once, the cockroach (its thread) should sleep random time for giving the others to move forward. The thread of cockroach, that has already finished, must "die". Races stop when the last cockroach run to the end line. After that the result table with number race, names (numbers) of members and their time should be printed in console.
In case of pressing Start during the race all cockroaches' threads must be "killed", cockroaches must be moved to the start line, and false start informtion must be printed in console.
All threads should be created from main class that extends from applet. The package should be realized using "pure Java" only. The result must be built as HTML file and Java classes. The task should work properly on all platforms and in all Java-enabled browsers.

Additonal tasks

  1. User should be able to "hurry" the cockroach by double clicking on it.
  2. Implement double buffering to avoid flickering.
  3. Create text area for every trace where user may type the name of cockroach. The name of leader should be displayed in special text field.
  4. In case of large number of race trackes user should be able to scroll the area.
  5. Implement frame version.

My source code

The source code is placed here (7 Kb).

main page © Evgeni Kudriavitski



Acquiring image from ProHosting Banner Exchange