Friday, March 6, 2009

Numero De Ativação Sound Blaster X-fi Mb

CALCULATOR IN JAVA

import java.awt .*;
import javax.swing .*;
import java.awt.event .*;


public class Calculator {private JFrame f = new JFrame ("Calculator");
private Panel p = new Panel ();
private JButton addition, subtraction
private JButton;
private JButton reproductive
private JButton division;

a private JButton;
private JButton two, three
private JButton;
private JButton four, five
private JButton;
private JButton six, seven
private JButton;
private JButton eight, nine
private JButton;
private JButton zero
private JLabel name;
private JLabel nomeDue = new JLabel ("type the second number ");
private JLabel r = new JLabel ();
private JLabel r1 = new JLabel (" result ");
Panel Private numbers;
PannelloComandi private transactions, private JTextField
incomplete;
private JTextField in1;
private JTextField in2;


public Calculator () {
f.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
f.setSize (500.500);
f.setLayout (new GridLayout (4,2));
numbers = new Panel ();
PannelloComandi operations = new ();
name = new JLabel ("enter first number");
InCom = new JTextField ( )
in1 = new JTextField ();
in2 = new JTextField ();
f.add (operations);
f.add (numbers);
f.add (in1);
f.add (name);
f.add (in2);
f.add (nomeDue)
f.add (r1);
f.add (r);
addizione.addActionListener (new sum ());
sottrazione.addActionListener (new subtraction ());
moltiplicazione.addActionListener (new multiplication ());
divisione.addActionListener (new split ());
f.setVisible (true);}


public class Panel extends JPanel {public
Panel () {
a = new JButton ("1");
this.add (a) two
= new JButton ("2");
this.add (two);
three = new JButton ("3");
this.add (three);
four = new JButton ("4");
this. add (four);
five = new JButton ("5");
this.add (five);
six = new JButton ("6");
this.add (six);
seven = new JButton (" 7 ");
this.add (seven);
eight = new JButton (" 8 ");
this.add (eight) nine = new
JButton ("9");
this.add (nine);
zero = new JButton ("0");
this.add (zero);


}} public class

PannelloComandi extends JPanel {public
PannelloComandi () {
addition = new JButton ("+");
this.add (addition);
subtract = new JButton ("-");
this.add (subtraction), multiplication
= new JButton ("X" )
this.add (multiplication);
division = new JButton ("/");
this.add (division);

}} public class

sum
implements ActionListener {public void actionPerformed (ActionEvent e) {
String t1 = in1.getText ();
in2.getText String t2 = ();
double x1 = Double.parseDouble (t1);
double x2 = Double.parseDouble (t2);
double s = x1 + x2;
String result = Double.ToString (s);
r.setText (result);}



} public class subtraction
implements ActionListener {public void actionPerformed (ActionEvent e) {String t1 =
in1.getText ();
String t2 = in2.getText ();
double x1 = Double.parseDouble (t1);
double x2 = Double.parseDouble (t2);
double-sub x1 = x2;
Double.ToString String result = (sub);
r.setText (result);



}} public class
multiplication implements ActionListener {public void actionPerformed (ActionEvent e) {String t1 =
in1.getText ();
in2.getText String t2 = ();
double x1 = Double.parseDouble (t1) ;
double x2 = Double.parseDouble (t2);
double m = x1 * x2;
Double.ToString String result = (m);
r.setText (result);}



} public class division implements ActionListener
{public void actionPerformed (ActionEvent e) {String t1 =
in1.getText ();
in2.getText String t2 = ();
double x1 = Double.parseDouble (t1);
double x2 = Double.parseDouble (t2 );
double d=x1/x2;
String risultato=Double.toString(d);
r.setText(risultato);
}
}
public static void main(String[] args){
Calcolatrice c=new Calcolatrice();
}

}
________________________________________________________________________________
Free Image Hosting at www.ImageShack.us

QuickPost Quickpost this image to Myspace, Digg, Facebook, and others!

0 comments:

Post a Comment