You may use your notes, the computer, and any previous programs we have developed this semester. Make sure you save your program in a folder named ClosestToCenter in your student folder.
Write a program that populates a screen with twenty particles in random locations. Each particle should be 20 pixels wide. Make all of the particles black. This program should color the particle that is closest to the center of the canvas red.
Hint one: Recall how you find the smallest item in an array. Hint two: write a function in the particle class named distanceToCenter that returns how far the particle is from the center of the canvas.
Start with Particle.java and Program.java file in the folder ClosestToCenter.