Implementing The Business Logic
Now it is time to implement the business logic of our calculator. We will utilize Java Stack class in order to implement our calculation logic. We will have two Stack instances; the first instance will hold the user input and the second stack will hold the intermediate calculation results. We will wrap our business logic as an instance method inside our main class. Here is our ProcessKeypadInput method along with some utility methods.