JAVA

PART -A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7

PART-B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

7.

 
  
 
 
import java.applet.*;

import java.awt.*;

import java.awt.event.*;


public class p7 extends Applet implements ActionListener

{

Button b1=new Button("ADD");

Label l1 =new Label("ENTER VALUE");
TextField t1=new TextField(10);
 


public void init()

{

t1.setText("3");
 

add(l1);

add(t1);

add(b1);
 

b1.addActionListener(this);

}

        int numberofpoints = 8;


 public void paint(Graphics g)
    { 
        int x[] = { 40,80,110,110,80,40,13,13};
   
        int y[] = { 13,13,40,80,110,110,80,40 };
		
		 
   
   
        g.setColor(Color.blue);
   
        g.drawPolygon(x, y, numberofpoints);
		 
    }

public void actionPerformed(ActionEvent ae)

{

int v1=Integer.parseInt(t1.getText());
 
numberofpoints=v1;

repaint(); 

}


}


/*

< html>  
< body>  
< applet code="p7.class" width="300" height="300">
< /applet>  
< /body>  

 
< /html>
*/

 
 

 


 



    <html>  
    <body>  
    <applet code="p7.class" width="300" height="300">  
    <param name="msg" value="Welcome to applet">  
    </applet>  
    </body>  
    </html>