2. Programmas kods
package pakete;
import java.awt.Color;
import java.util.Random;
import java.awt.Graphics;
class CP{
public static int[] x=new int[8];
public static int[] y=new int[8];
public static double[] B=new double[8];
Graphics g = jPanel1.getGraphics();
g.setColor(Color.white);
g.fillRect(0,0,jPanel1.getWidth(), jPanel1.getHeight());
for ( int i=0; i<8; i++){
g.setColor(Color.red);
g.drawOval(CP.x[i]-2,CP.y[i]-2,4 ,4);
g.setColor(Color.black);
g.drawString(String.valueOf(i+1),CP.x[i]-3, CP.y[i]-3);
}
Random val = new Random();…