Java Reference
In-Depth Information
this .addWindowListener( new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
setVisible( true );
}
//Place the definition of the method actionPerformed
//as described here
//Place the definition of the method evaluate
//as described here
public static void main(String[] args)
{
Calculator C = new Calculator();
}
}
Sample Run 1: In this sample run (see Figure 11-9), the user entered the numbers
34 and 25 , the operation + , and = . The result is shown in the bottom screen.
FIGURE 11-9 Adding numbers 34 and 25
Sample Run 2: In this sample run (see Figure 11-10), the user attempted to divide
by 0 , resulting in an error message.
Search WWH ::




Custom Search