Under the Guidance of
Sri S.V.G.REDDY,
ASSOCIATE PROFESSOR,
DEPT. OF CSE,
GIT , GITAM UNIVERSITY.
2/4 B.Tech (B4), CSE DEPARTMENT
GIT, GITAM UNIVERSITY
INDEX
Name: Regd no:
Section: Branch:
S. No Name of the program Page No Signature
*1
Temparature Conversion 1 - 2
*2
Bank Account Class 3 - 6
*3
String Palindrome 7 - 8
4
2D String Array 9 -11
5
Commandline & Static 12 - 13
6
Abstract classes & methods 14 - 16
7
Access Controls 17 - 18
8
Method Overloading 19 - 21
9
Constructor Overloading 22 - 23
10
Multilevel Inheritance 24 - 25
11
Hierarchial Inheritance 26 - 27
*12
Multiple
Inheritance(Interface)
28 - 30
13
Method Over-riding 31 - 34
14
Prevention using "Final" 35 - 36
15
System defined exceptions 37 - 38
16
User defined exceptions 39 - 40
*17
Threads with "Runnable" 41 - 42
18
Threads with priority 43 - 44
19
Flow Layout 45 - 47
20
Border Layout 48 - 49
21
Grid Layout 50 - 51
22
Label 52 - 53
23
Button 54 - 56
24
Checkbox 57 -59
25
Checkbox Group 60 - 62
26
Choice 63 - 65
INDEX
Name: Regd no:
Section: Branch:
S. No Name of the program Page No Signature
27
List 66 - 68
28
Text Field 69 - 71
29
Text Area 72 - 73
*30
User inputs in applet 74 - 76
*31
Future Investment 77 - 79
*32
Frames and Panels 80 - 81
*33
Mouse pressed location 82 - 83
*34
Mouse events 84 - 86
*35
Drawing Shapes 87 - 88
*36
Barcharts with passing
parameters
89 - 90
*37
Barcharts with different
inputs
91 - 93
38
39
40
* : Lab cycle programs
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 1
PROGRAM – 1
AIM:
To develop a program to convert the given temparature in
Fahrenheit to Celcius.
SOURCE CODE:
import java.io.*;
public class TempConvert
{
public static void main( String ar[] )throws IOException
{
DataInputStream d =new DataInputStream( System.in );
String s1[] =new String[10];
String s2;
float a[] =new float[10];
float b[] =new float[10];
System.out.println("Enter the no.of temparature
readings:");
s2 =d.readLine();
int n =Integer.parseInt( s2 );
System.out.println("Enter the " +n +" readings in
Fahrenheit scale:");
for( int i =0 ; i <n ; i++)
{
s1[i] =d.readLine();
for( int i =0 ; i <n ; i++)
{
System.out.println( " " +a[i] +"\t\t" +b[i] );
}
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 3
PROGRAM – 2
AIM:
Develop a program to design a class that represents a bank
account,including the following members:
DATA MEMBERS:
1.Name of the depositor
2.Account number
3.Type of account
4.Balance
METHODS:
1.To assign initial values
2.To deposit an amount
3.To withdraw an amount after checking balance
4.To display the name,account number and
balance
SOURCE CODE:
import java.io.*;
class BankRep
{
double bal , wthd , dep;
int ty;
DataInputStream d =new DataInputStream( System.in );
String name , s3 , s4 , s5 , s6 , acc;
public void init()throws IOException
{
System.out.println("Enter the name of account-holder:");
name =d.readLine();
System.out.println("Enter the account number:");
acc =d.readLine();
System.out.println("Types of account:\n1.CURRENT\n2.SAVINGS\n3.FIXED
DEPOSIT\nEnter choice:");
s3 =d.readLine();
ty =Integer.parseInt( s3 );
switch( ty )
{
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 4
case 1: s3 ="CURRENT";
break;
case 2: s3 ="SAVINGS";
break;
case 3: s3 ="FIXED DEPOSIT";
break;
default:System.out.println("Illegal entry!!");
}
System.out.println("Type of account entered:" +s3);
System.out.println("Enter the amount present in account:");
s4 =d.readLine();
bal =Double.parseDouble( s4 );
}
public void deposit()throws IOException
{
System.out.println("Enter the amount to deposit:");
s5 =d.readLine();
dep =Double.parseDouble( s5 );
bal =bal +dep;
}
public void withd()throws IOException
{
System.out.println("Enter the amount to withdraw:");
s6 =d.readLine();
wthd =Double.parseDouble( s6 );
bal =bal - wthd;
}
public void enq()
{
System.out.println("Balance is:" +bal);
}
public void display()
{
System.out.println("The updated details of account are:\nNAME:" +name +
"\nAccount Number:" +acc +"\nBalance in account after last transaction:" +bal);
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 5
}
}
public class Class
{
public static void main( String ar[] )throws IOException
{
BankRep b =new BankRep();
b.init();
int ch;
String s;
DataInputStream k =new DataInputStream( System.in );
do
{
System.out.println("Type of
Transaction:\n1.DEPOSIT\n2.WITHDRAWL\n3.BALANCE ENQUIRY\n4.EXIT\nEnter choice:");
s =k.readLine();
ch =Integer.parseInt( s );
switch( ch )
{
case 1: b.deposit();
break;
case 2: b.withd();
break;
case 3: b.enq();
break;
case 4: b.display();
System.exit(0);
default:System.out.println("Illegal choice!!");
}
}while( ch !=5 );
}
}
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 6
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 7
PROGRAM – 3
AIM:
Develop a program that takes a string from the commandline
arguments and checks whether it is a palindrome or not.
SOURCE CODE:
public class StrPalind
{
public static void main( String ar[] )
{
String s=ar[0];
System.out.println("The given string is:" +ar[0] );
PROGRAM – 7
AIM:
Develop a program to demonstrate the access specifiers .
SOURCE CODE:
class Test
{
int a;
public int b;
private int c;
void setc(int i)
{
c =i;
}
int getc()
{
return c;
}
}
class AccessTest
{
public static void main(String args[])
{
Test ob =new Test();
ob.a =10;
ob.b =20;
ob.setc(100);
System.out.println("a, b, and c: " +ob.a +" " +ob.b +" " +ob.getc());
}
}
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 18
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 19
PROGRAM – 8
AIM:
Develop a program to demonstrate the method overloading .
SOURCE CODE:
import java.io.*;
class OverloadDemo
{
void test()
{
System.out.println("No parameters");
}
void test(int a)
{
System.out.println("a: " +a);
}
void test(int a, int b)
{
System.out.println("a and b: " +a +" " +b);
}
double test(double a)
{
System.out.println("double a: " +a);
return a*a;
}
}
class Test
{
public static void main( String ar[] )throws IOException
{
int ch ;
String s;
double result;
DataInputStream d =new DataInputStream( System.in );
OverloadDemo ob =new OverloadDemo();
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 20
do
{
System.out.println("MENU\n1.Call method with no parameters\n2.Call
method with one integer parameters");
System.out.println("3.Call method with two integer parameters\n4.Call
method with a double parameter");
PROGRAM – 9
AIM:
Develop a program to demonstrate the constructor overloading .
SOURCE CODE:
import java.io.*;
class Box
{
double width;
double height;
double depth;
Box(double w, double h, double d)
{
width =w;
height =h;
depth =d;
}
Box()
{
width =5; // use -1 to indicate
height =5; // an uninitialized
depth =5; // box
}
Box(double len)
{
width =height =depth =len;
}
double volume()
{
return width * height * depth;
}
}
class OverloadCons
{
public static void main( String ar[] )
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 23
{
Box mybox1 =new Box( 100 , 200 , 150 );
Box mybox2 =new Box();
Box mycube =new Box( 70 );
double vol;
vol =mybox1.volume();
System.out.println("Volume of mybox1 is " +vol);
vol =mybox2.volume();
System.out.println("Volume of mybox2 is " +vol);
vol =mycube.volume();
System.out.println("Volume of mycube is " +vol);
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 24
PROGRAM – 10
AIM:
Develop a program to demonstrate multilevel inheritance.
SOURCE CODE:
import java.io.*;
class student
{
int roll_no;
public void getnumber(int m)
{
roll_no =m;
}
}
class marks extends student
{
int marks1,marks2;
public void getmarks(int m,int n)
{
marks1 =m;
marks2 =n;
}
}
class results extends marks
{
void putdetails()
{
int total=marks1+marks2;
System.out.println("\nStudent roll number : "+roll_no);
System.out.println("\nMarks Obtained:");
System.out.println("Marks1 ="+marks1);
System.out.println("Marks2 ="+marks2);
System.out.println("\nTotal ="+total);
}
}
class exam
{
public static void main(String args[])throws IOException
{
DataInputStream d =new DataInputStream(System.in);
String s1,s2,s3;
int a,b,c;
System.out.println("Enter roll-number : ");
s1=d.readLine();
System.out.println("Enter Marks : ");
s2=d.readLine();
JAVA RECORD - 2/ 4 B4
PROGRAM – 14
AIM:
Develop a program to demonstrate how to prevent method over-
riding using "final" keyword.
SOURCE CODE:
//Program to prevent method overloading using final keyword:#1
class A
{
final void meth()
{
System.out.println("This is a final method.");
}
}
class B extends A
{
void meth()
{
// ERROR! Can't override.
System.out.println("Illegal!");
}
}
class TestFinal
{
public static void main( String ar[] )
{
B b =new B();
b.meth();
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 36
//Program to prevent method overloading using final keyword:#2
class A
{
final void meth()
{
System.out.println("This is a final method.");
}
}
class B extends A {}
class TestFinal
{
public static void main( String ar[] )
{
B b =new B();
b.meth();
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 37
PROGRAM – 15
AIM:
Develop a program to demonstrate how to handle system defined
exceptions.
SOURCE CODE:
class Multicatch
{
public static void main(String args[])
{
int a[]={5 , 10 };
int b =5;
try
{
int z =a[2] / b - a[1];
}
catch( ArithmeticException e )
{
System.out.println("Division by zero");
}
catch( ArrayIndexOutOfBoundsException e )
{
System.out.println("Array out of bounds");
}
catch( NullPointerException e )
{
System.out.println("Null exception");
}
finally
{
System.out.println("System defined exception is caught!");
int y =a[1] / a[0];
System.out.println( "Value =" +y );
}
}
}
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 38
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 39
PROGRAM – 16
AIM:
Develop a program to demonstrate how to handle user defined
exceptions.
SOURCE CODE:
import java.io.*;
class MyException extends Exception
{
private float detail;
MyException(float a)
{
detail =a;
}
public String toString()
{
return "MyException[" +detail +"]";
}
}
class ExceptionDemo
{
static void compute(float a) throws MyException
{
System.out.println("Called compute(" +a +")");
if(a <1)
throw new MyException(a);
System.out.println("Normal exit");
}
public static void main( String ar[] )throws IOException
{
int a , b;
float r;
DataInputStream d =new DataInputStream( System.in );
System.out.println("Enter the values of a and b:");
PROGRAM – 17
AIM:
Develop a program to demonstrate multithreading concept using
"Runnable " interface.
SOURCE CODE:
class Runnabletest implements Runnable
{
int i;
class Runnabledemo
{
public static void main(String args[])
{
Runnabletest x=new Runnabletest("First thread");
Runnabletest y=new Runnabletest("second thread");
Thread t1=new Thread(x);
Thread t2=new Thread(y);
t1.start();
t2.start();
}
}
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 42
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 43
PROGRAM – 18
AIM:
Develop a program to demonstrate multithreading concept
implementing priorities.
SOURCE CODE:
import java.io.*;
class A extends Thread
{
publc void run( ) throws IOException
{
DataInputStream d =new DataInputStream( System.in );
for(int j=1;j<=5;j++)
{
System.out.println("\nEnter the value for thread A:");
String s =d.readLine( );
}
System.out.println("\t Exit from A");
}
}
class B extends Thread
{
public void run( )throws IOException
{
for(int j=1;j<=5;j++)
{
System.out.println("\nEnter the value for thread B:");
String s =d.readLine( );
}
System.out.println("\t Exit from B");
}
}
class C extends Thread
{
public void run( )throws IOException
{
for(int k=1;k<=5;k++)
{
System.out.println("\nEnter the value for thread C:");
String s =d.readLine( );
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 44
}
System.out.println("\t Exit from C");
}
}
class Test
{
public static void main(String args[])
{
A ob1 =new A( );
B ob2 =new B( );
C ob3 =new C( );
ob3.setPriority( Thread.MAX_PRIORITY );
ob2.setPriority( ob1.getPriority( ) +1 );
ob3.setPriority( Thread.MIN_PRIORITY );
System.out.println( "Start Thread A" );
ob1.start( );
System.out.println( "Start Thread B" );
ob2.start( );
System.out.println( "Start Thread C" );
ob3.start( );
System.out.println( "End of Main Thread" );
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 45
PROGRAM – 19
AIM:
Develop a program to demonstrate flow layout.
SOURCE CODE:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code ="FlowLayoutDemo"
width =400
height =200>
</applet>
*/
public class FlowLayoutDemo extends Applet implements ItemListener
{
String msg =" ";
Checkbox win98 , winNT , solaris , mac;
public void init()
{
setLayout( new FlowLayout( FlowLayout.LEFT ) );
win98 =new Checkbox("Windows 98/XP",null,true);
winNT =new Checkbox("Windows NT");
solaris =new Checkbox("Solaris");
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 46
mac =new Checkbox("Apple's Mac");
add( win98 );
add( winNT );
add( solaris );
add( mac );
win98.addItemListener( this );
winNT.addItemListener( this );
solaris.addItemListener( this );
mac.addItemListener( this );
}
public void itemStateChanged( ItemEvent ie )
{
repaint( );
}
public void paint( Graphics g )
{
msg ="Current State:";
g.drawString( msg , 6 , 80 );
msg ="Windows 98/XP:"+win98.getState( );
g.drawString( msg , 6 , 100 );
msg ="Windows NT:"+winNT.getState( );
g.drawString( msg , 6 , 120 );
msg ="Solaris:"+solaris.getState( );
g.drawString( msg , 6 , 140 );
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 47
msg ="Apple's Macintosh:"+mac.getState( );
g.drawString( msg , 6 , 160 );
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 48
PROGRAM – 20
AIM:
Develop a program to demonstrate border layout.
SOURCE CODE:
import java.awt.*;
import java.awt.event.*;
public class ShowBorderLayout extends Frame
{
public ShowBorderLayout( )
{
setTitle("ShowBorderLayout");
setLayout( new BorderLayout( 5 , 10 ) );
add("East", new Button("India on the East") );
add("South", new Button("Australia on the South") );
add("West", new Button("America on the West") );
add("North", new Button("Britain on the North") );
add("Center", new Button("Africa on the Center") );
}
public static void main( String ar[ ] )
{
Frame f =new ShowBorderLayout();
f.setSize( 400 , 300 );
f.setVisible( true );
f.addWindowListener( new WindowAdapter()
{
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 49
public void windowClosing( WindowEvent evt )
{
System.exit( 0 );
}
});
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 50
PROGRAM – 21
AIM:
Develop a program to demonstrate grid layout.
SOURCE CODE:
import java.awt.*;
import java.awt.event.*;
public class ShowGridLayout extends Frame
{
public ShowGridLayout( )
{
setTitle("Grid Layout");
setLayout( new GridLayout( 4 , 3 , 5 , 5 ) );
for( int i =1 ; i <=10 ; i++)
{
add( new Button("Component#"+i) );
}
}
public static void main( String ar[ ] )
{
Frame f =new ShowGridLayout( );
f.setSize( 400 , 300 );
f.setVisible( true );
f.addWindowListener( new WindowAdapter( )
{
public void WindowClosing( WindowEvent evt )
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 51
{
System.exit( 0 );
}
});
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 52
PROGRAM – 22
AIM:
Develop a program to demonstrate GUI component "Label".
SOURCE CODE:
import java.awt.*;
import java.applet.*;
/*
<applet code="LabelDemo" width=100 height=100>
</applet>
*/
public class LabelDemo extends Applet
{
public void init()
{
Label one =new Label("My name");
Label two =new Label("is");
Label three =new Label("Namburi VK");
add(one);
add(two);
add(three);
}
}
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 53
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 54
PROGRAM – 23
AIM:
Develop a program to demonstrate GUI component "Button".
SOURCE CODE:
import java.awt.*;
public class TextAreaDemo extends Applet implements ActionListener
{
TextArea a;
Button b;
Label l1;
String msg ="";
public void init()
{
l1 =new Label("Write about yourself in less than 250 characters:");
b =new Button("SUBMIT");
a =new TextArea();
add( l1 );
add( a );
add( b );
b.addActionListener(this);
}
public void actionPerformed( ActionEvent ae )
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 73
{
String str =ae.getActionCommand();
if( str.equals("SUBMIT") )
{
msg ="Your answer is submitted!";
}
repaint();
}
public void paint( Graphics g )
{
g.drawString( msg , 180 , 250 );
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 74
PROGRAM – 30
AIM:
Develop an applet that receives three numeric values as input
from the user and then display the largest of the three.
SOURCE CODE:
import java.applet.*;
PROGRAM – 31
AIM:
Develop program to calculate the future value of an investment at
a given interest rate for a specified number of years. The formula for the
calculat ion is as follows:
Future value =Investment Amount (1+Interest Rate) years.
Use text fields for interest rate, investment amount and years. Display the
future amount in a textfield when clicking the calculate button, or
choosing calculate form the operation menu.
SOURCE CODE:
import java.awt.*;
PROGRAM – 32
AIM:
Develop a program to meet the following requirements
(a) Create a frame with flow layout
(b) Create two panels and add the panels to the frame
(c) Each panel contains three buttons. The panel uses flow layout.
SOURCE CODE:
import java.awt.*;
public class PanFrReq extends Frame
{
public void init()
{
FlowLayout x=new FlowLayout();
setLayout(x);
Panel p1=new Panel();
p1.setSize(100,100);
Panel p2=new Panel();
p2.setSize(100,100);
Button btn1=new Button("B1");
Button btn2=new Button("B2");
Button btn3=new Button("B3");
Button btn4=new Button("B4");
Button btn5=new Button("B5");
Button btn6=new Button("B6");
p1.add(btn1);
p1.add(btn2);
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 81
p1.add(btn3);
p2.add(btn4);
p2.add(btn5);
p2.add(btn6);
add(p1);
add(p2);
p1.setForeground( Color.red );
p2.setForeground( Color.blue );
setSize(500,500);
setVisible(true);
}
public static void main(String args[])
{
PanFrReq ob=new PanFrReq();
ob.init();
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 82
PROGRAM – 33
AIM:
Develop a program to display the mouse position when the mouse
is pressed.
SOURCE CODE:
import java.applet.*;
public void init()
{
addMouseListener(new mymouselistener());
}
public void start()
{
}
public void paint(Graphics g)
{
g.drawLine(x,y,x,y);
g.drawString(x +","+y, x,y);
}
public class mymouselistener extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
x =e.getX();
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 83
y =e.getY();
repaint();
}
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 84
PROGRAM – 34
AIM:
Develop a program to handle mouse events.
SOURCE CODE:
import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
/*<applet code="Mouse"
width =400
height =300>
</applet>*/
public class Mouse extends Applet implements MouseListener,MouseMotionListener
{
String txt="";
int x=10,y=30;
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}
public void mouseClicked(MouseEvent me)
{
txt="Mouse Clicked";
setForeground(Color.magenta);
repaint();
}
public void mouseEntered(MouseEvent me)
{
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 85
txt="Mouse Entered";
repaint();
}
public void mouseExited(MouseEvent me)
{
txt="Mouse Exited";
setForeground(Color.cyan);
repaint();
}
public void mousePressed(MouseEvent me)
{
txt="Mouse Pressed";
setForeground(Color.blue);
repaint();
}
public void mouseMoved(MouseEvent me)
{
txt="Mouse Moved";
setForeground(Color.red);
repaint();
}
public void mouseDragged(MouseEvent me)
{
txt="Mouse Dragged";
setForeground(Color.green);
repaint();
}
public void mouseReleased(MouseEvent me)
{
txt="Mouse Released";
setForeground(Color.gray);
repaint();
}
public void paint(Graphics g)
{
g.drawString(txt,200,150);
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 86
showStatus("Mouse events Handling");
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 87
PROGRAM – 35
AIM:
Develop an applet to draw the following shapes.
1.Cone
2.Cylinder
3.Cube
4.Square inside a circle
5.Circle inside a square
SOURCE CODE:
import java.awt.*;
g.drawString("circle in square",30,470);
g.drawOval(220,350,100,100);
g.drawRect(235,365,70,70);
g.drawString("square in circle",220,470);
}
}
OUTPUT:
JAVA RECORD - 2/ 4 B4
CSE,GIT,GITAM University Page 89
PROGRAM – 36
AIM:
Develop an applet to display a bar chart by passing parameters to
applet.
SOURCE CODE:
/* <applet code="exBarChart"
height=300
width=350>
<param name ="totcol" value="4">
<param name ="c1" value ="110">
<param name ="c2" value ="150">
<param name ="c3" value ="100">
<param name ="c4" value ="170">
<param name ="lbl1" value ="2010">
<param name ="lbl2" value ="2011">
<param name ="lbl3" value ="2012">
<param name ="lbl4" value ="2013">
</applet>*/
import java.awt.*;
import java.applet.*;
public class exBarChart extends Applet
{
int n=0;
String label[];
int value[];
public void init()
{
try
{
n =Integer.parseInt(getParameter("totcol"));