Results 1 to 2 of 2
Thread: need help with this java 2d ques
- 04-14-2009, 09:33 PM #1Member
- Join Date
- Apr 2009
- Rep Power
need help with this java 2d ques
am new to java and need help on how to create such a program
A program in Java which depicts a 2-D animation of a railway engine (aka a locomotive) moving around a circular track.
You should provide the following controls for the railway engine:
1. an accelerator
2. a brake
You should not however be concerned with transmission system or clutches.
The locomotive should initially be stationary with its engine started; consequently, “pressing” the accelerator should cause it to accelerate up to its maximum speed for that setting of the accelerator. Applying the brake should, of course, cause the locomotive to decelerate. If both the accelerator and the brake are applied, what should happen is for you to determine; you might decide that the only way for the railway engine to come to a halt is for the brakes to be applied, but not the accelerator. You might decide to use vertical sliders for both controls.
The locomotive itself can be drawn as a simple model in plan view but should have 4 wheels, a body and a driver’s cabin at the very least. The track might be drawn as 2 simple circles depicting the rails; there is no need to draw anything very elaborate. There should however be an area inside the track as well as an area outside the track.
Once the railway engine is moving, your program will need to constantly refresh the drawing. At the same time, your program will need to respond to the controls. This means that you will need to use separate threads.
- 04-14-2009, 10:06 PM #2
please no double posting.USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)