i need help ? ? ? with my calculator
hello every one i have to prepare a home work and i did it as i can and i have one more thign to do it and it does not work with me ?
so please can any one here ,can help me with it ?
(((Write a simple calculator that is able to perform four basic arithemtic operations. The length of the numbers is not limited.
Ex.: 23456789012345678901 * 34567890123456789012 = 810851705227873922221249233290657035812
(check it, is it true? :-))
The user can specify the number of decimal digits in the division result. Allow repeated calculations. Store the record of the session in a text file. )))
this is the main question to create calculator.and i need to receive full answer without (( E )) how it can be ?
*********************this is the program which i did:
********************
import java.awt.*;
import java.awt.event.*;
public class Calculator extends Frame
{
Button bt=new Button("Save");
Button bt2=new Button("Refresh");
Button b1;
Button b2;
Button b3;
Button b4;
TextField tx1;
TextField tx2;
TextField tx3;
Panel p1= new Panel();
Panel p2 = new Panel();
public Calculator()
{
this.setTitle("Simple Calculator");
this.setSize(500,200);
this.setLayout(new FlowLayout());
this.setBackground(Color.GREEN);
tx1 = new TextField("Enter your 1st number");
this.add(tx1);
b1 = new Button("+");
this.add(b1);
b1.addActionListener(new Listener_b1());
b2 = new Button("-");
this.add(b2);
b2.addActionListener(new Listener_b2());
b3 = new Button("X");
this.add(b3);
b3.addActionListener(new Listener_b3());
b4 = new Button("/");
this.add(b4);
b4.addActionListener(new Listener_b4());
tx2 = new TextField("Enter your 2nd number");
this.add(tx2);
tx3 = new TextField("Result:");
this.add(tx3);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(1); }
});
}
class Listener_b1 implements ActionListener {
public void actionPerformed(ActionEvent e){
try {
double q = Double.parseDouble(tx1.getText());
double p = Double.parseDouble(tx2.getText());
tx3.setText("Result: "+(q+p));
}
catch (Exception ee) {
tx3.setText("input error");
}
}
}
class Listener_b2 implements ActionListener {
public void actionPerformed(ActionEvent e){
try{
double q = Double.parseDouble(tx1.getText());
double p = Double.parseDouble(tx2.getText());
tx3.setText("result: "+(q-p));
}
catch (Exception ee) {
tx3.setText("input error");
}
}
}
class Listener_b3 implements ActionListener {
public void actionPerformed(ActionEvent e){
try{
double q = Double.parseDouble(tx1.getText());
double p = Double.parseDouble(tx2.getText());
tx3.setText("result: "+(q*p));
}
catch (Exception ee) {
tx3.setText("input error");
}
}
}
class Listener_b4 implements ActionListener {
public void actionPerformed(ActionEvent e){
try{
double q = Double.parseDouble(tx1.getText());
double p = Double.parseDouble(tx2.getText());
tx3.setText("result: "+(q/p));
if(p==0){
tx3.setText("input error... Cannot devide by zero");
}
}
catch (Exception ee) {
tx3.setText("input error");
}
}
}
public static void main(String[] args)
{
new Calculator().setVisible(true);
}
}
***************************************
i want receive >>>810851705227873922221249233290657035812 instead of 81085170522 E 21457

