Guys I have an homework activity creating a simple calculator and I encountered some errors in my code can someone help me out of this activity or revised my code. My code have not finish yet and still thinking how my calculator works or what code to be in functionality. Here are my codes so far. thanks alot:(
import java.awt.*;
class Calculator extends Frame{
public static void main(String [] args){
Frame f = new Frame("Calculator");
f.setSize(250,250);
f.setVisible(true);
Panel panei1 = new Panel();
Panel panel2 = new Panel();
panel2.setLayout(new GridLayout(4,4,55));
panel1.add(new Textfield(20));
panel1.add(new Button("Clear"));
panel2.add(new Button("7"));
panel2.add(new Button("8"));
panel2.add(new Button("9"));
panel2.add(new Button("/"));
panel2.add(new Button("4"));
panel2.add(new Button("5"));
panel2.add(new Button("6"));
panel2.add(new Button("*"));
panel2.add(new Button("1"));
panel2.add(new Button("2"));
panel2.add(new Button("3"));
panel2.add(new Button("-"));
panel2.add(new Button("0"));
panel2.add(new Button("."));
panel2.add(new Button("="));
panel2.add(new Button("+"));
f.add(panel1,BorderLayout.NORTH);
f.add(panel2,BorderLayout.CENTER);
f.pack();
}
}