This is what the program looks like
This is the code
import java.awt.*;
public class Scene extends java.applet.Applet
{
Person f1, f2, f3, f4, f5, f6;
public void init()
{
f1 = new Person(10, 100);
f2 = new Person(10, 150);
f3 = new Person(10, 200);
f4 = new Person(10, 250);
f5 = new Person(10, 300);
f6 = new Person(10, 350);
}
public void paint(Graphics g)
{
f1.paint(g);
f2.paint(g);
f3.paint(g);
f4.paint(g);
f5.paint(g);
f6.paint(g);
}
}
public class Person {
int x,y;
Limb leftarm, rightarm, leftleg, rightleg;
Person(int startx, int starty) {
x = startx;
y = starty;
leftarm = new Limb(x, y+5, x-5, y+5);
rightarm = new Limb(x, y+5, x+5, y+5);
leftleg = new Limb(x, y+10, x-3, y+13);
rightleg = new Limb(x, y+10, x+3, y+13);
}
public boolean paint(Graphics g) {
// Body
g.drawLine(x,y,x, y+10);
// Head
g.drawOval(x-3, y-6, 6, 6);
// Limbs
leftarm.paint(g);
rightarm.paint(g);
leftleg.paint(g);
rightleg.paint(g);
return true;
}
}
public class Limb {
int x,y, x2, y2;
Limb(int startx, int starty, int endx, int endy) {
x = startx;
y = starty;
x2 = endx;
y2 = endy;
}
public void paint(Graphics g) {
g.drawLine(x,y,x2, y2);
g.drawOval(x2-2, y2-2, 4, 4);
}
}