Part 1:

Write an applet that bounces a ball inside its graphics area. The ball must start in a random location, move in a random direction, and must bounce when it reaches the edge of the graphics area. (This does not require threads.)

Part 2:

Write a second applet that bounces multiple balls; the number is specified by a parameter in the HTML file. Assign different colors to different balls (you can have 10 unique colors and re-use colours after that). The balls can move independently, passing through each other. Each should have its own thread.

Part 3:

Write a third applet, this time with code so that the balls bounce off each other. A collision will occur between two balls when the distance between their centres is less than the sum of their radii. (Note that this will require synchronization between threads.)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.