Hey Jow Forumsuys. I need some help on this Java project i'm working on.
Here is a little background:
I am working on making an RPN Calculator (Reverse Polish Notation). In which I have a stack that has numbers pushed onto it. Those numbers are then added, subtracted, multiplied etc... depending on the button that was pressed. (+, -, *, /,....).
There are currently 9 Buttons and 3 text fields.
The buttons are:
+,-,*,/,push,dup,2dup,clr,pop
the text fields are:
Input, Display, Error
I am struggling to make the buttons actually do the operations I have written in another Java file already. Here is an example.
I have added this line of code under my "Main" method.
FourthStack S = new FourthStack(4);
and then have this as the code for my "Push" button.
JButton pushBtn = new JButton("push");
pushBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double num;
num = Double.parseDouble(input_Fld.getText());
S.push(num);
}
});
pushBtn.setBounds(159, 175, 89, 23);
frame.getContentPane().add(pushBtn);
However I am getting an Error saying "S can not be resolved"
Can anyone help? If so, id be greatly appreciated. And any further help along the way of this project would be amazing. Thank you guys!
>Pic related, image of my "Design code"
I can attach other pictures aswell involving code from the Design, my other classes etc...
If anyone would like to contact me over Kik let me know I would be greatly appreciative!
Attached: RPNcodeExample.png (632x868, 45K)