Java to implement Smiley face Using applet

Write a Java to implement Smiley face Using applet:-

import java.awt.*;
import java.applet.*;
/*<APPLET
CODE = Face.class
WIDTH =250
HEIGHT = 200 >
<param name="a" value =10>
<param name="b" value =20>
</APPLET>*/
public class Face extends Applet
{
public void paint (Graphics g)
{
String a;
String b;
String c;
a=getParameter("a");
b=getParameter("b");
int p=Integer.parseInt(a);
int q=Integer.parseInt(b);
int sum=p+q;
c=Integer.toString(sum);
g.drawString("First value :-"+a,10,210);
g.drawString("Second value :-"+b,10,230);
g.drawString("Total sum :-"+c,10,250);
g.drawLine(10,212,130,212);
g.drawLine(10,232,130,232);
g.drawLine(10,252,130,252);
Color c1=new Color(25,0,0);
setBackground(c1);
setForeground(Color.green);
g.drawRect(200,160,100,50);
g.fillRect(200,40,100,50);
g.drawOval(40,40,120,150);
g.drawOval(57,75,30,20);
g.drawOval(110,75,30,20);
g.fillOval(68,81,10,10);
g.fillOval(121,81,10,10);
g.drawOval(85,100,30,30);
g.fillArc(60,125,80,40,180,180);
g.drawOval(25,92,15,30);
g.drawOval(160,92,15,30);
}
}

Related Posts