import java.io.*; import java.lang.*; import java.util.*; public class Calculator { private Stack stack; Calculator () { stack = new Stack(); } public void processInput (String input) { int value = 0; if (input.equals("+")) { // fill in here } else if (input.equals("*")) { // fill in here } else { // need to convert string to int here value = Integer.parseInt(input); stack.push(new Integer(value)); System.out.println(stack.pop()); } } public static void main(String[] arg) throws Exception { // this is code to take input from the keyboard Calculator calc = new Calculator(); InputStreamReader isr; BufferedReader keyboard; String inputLine; isr = new InputStreamReader(System.in); keyboard = new BufferedReader(isr); // put in a loop here to read input until done // you will need to also check for an input meaning end // this is an example of the input call you will make // within the loop inputLine = keyboard.readLine(); calc.processInput(inputLine); // put in code to call the calculator methods here. } }