import java.applet.Applet; import java.awt.*; class crcl{ private int xc=0, yc=0, rd=0; public void set_val(int xa, int ya, int radius){ xc=xa; yc=ya; rd=radius; // (xc,yc) is the center of the circle // rd is the radius }// method set_vaL public void draw(Graphics page) { page.drawOval(xc-rd,yc-rd,2*rd,2*rd); }// method draw public void fill(Graphics page) { page.fillOval(xc-rd,yc-rd,2*rd,2*rd); }// method fill }// class crcl public class hw2 extends Applet{ private crcl crcl1,crcl2,crcl3; private Graphics page; public void init(){ crcl1 = new crcl(); crcl2 = new crcl(); crcl3 = new crcl(); setSize(600,600); setVisible(true); page = getGraphics(); }// method init public void paint(Graphics page){ draw(page); }// method paint public void draw (Graphics page){ page.setColor(Color.blue); page.fillRect(0,0,600,600); page.setColor(Color.red); crcl1.set_val(200,200,50); crcl1.draw(page); crcl2.set_val(400,400,75); crcl2.draw(page); page.setColor(Color.green); crcl3.set_val(200,400,100); crcl3.fill(page); }//method draw }// class hw2