You are on page 1of 2

import java.awt.

*;
import java.net.*;
import java.awt.event.*;
public class CC extends Frame implements ActionListener
{ TextField t1; TextField t2; TextField t3; TextField t4; TextField t5;
TextField t6;
CC ()
{
setLayout(new FlowLayout());

Label l1 = new Label("Currency Converter");


add(l1);
Label l2 = new Label(" Enter Currency In Rupees(INR) ");
add(l2);
t1 = new TextField(20);
add(t1);

Label l3 = new Label(" Converted into Euro (EUR) ");


add(l3);

t2= new TextField(20);


add(t2);

Label l4 = new Label(" Converted into Canadian Dollar (CAD) ");


add(l4);

t3 = new TextField(20);
add(t3);

Label l5 = new Label(" Converted into Brazilian Real(BRL) ");


add(l5);

t4 = new TextField(20);
add(t4);

Label l6 = new Label(" Converted into United States Dollar(USD) ");


add(l6);

t5 = new TextField(20);
add(t5);

Label l7 = new Label(" Converted into Swiss franc(CHF) ");


add(l7);

t6 = new TextField(20);
add(t6);

Button b1 = new Button("Convert");


add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str =ae.getActionCommand();
if(str.equals("Convert"))
{
int n =Integer.parseInt( t1.getText());
t2.setText(" "+(n*0.0117570855));
t3.setText(" "+(n*0.0164093503));
t4.setText(" "+(n*0.0662422753));
t5.setText(" "+(n*0.0122444132));
t6.setText(" "+(n*0.0115831292));
}
}
public static void main(String args[])
{
CC obj = new CC();
obj.setSize(300,300);
obj.setVisible(true);

obj.setTitle("Currency Converter");
}
}

You might also like