Posts

Showing posts from March, 2014

Simple Calculator in Java

Image
Here's the screenshot below: It can only perform one operation at a time. import java.lang.*; import java.awt.*; import java.awt.event.*; public class calculator extends Frame implements ActionListener { Button btn1 = new Button("1"); Button btn2 = new Button("2"); Button btn3 = new Button("3"); Button plus = new Button("+"); Button btn4 = new Button("4"); Button btn5 = new Button("5"); Button btn6 = new Button("6"); Button minus = new Button("-"); Button btn7 = new Button("7"); Button btn8 = new Button("8"); Button btn9 = new Button("9"); Button times = new Button("*"); Button btn_clr = new Button("C"); Button btn0 = new Button("0"); Button divide = new Button("/"); Button ekwals = new Button("="); TextField txt = new Text...