Overview | Schedule | Announcements | Resources | Assignments | Home |
You have already been working on this project and are almost finished. The items to be completed, including what you have already done are:
* You should have already completed this.
You have been given a calculator project that will function once you complete item 3 above. You should have completed item 3 in lab 6. Following are the details for items 4 through 7.
Item 4: Write a stackDump method in the Stack class. This method will remove all items from the stack, but before doing so will display the contents of the stack from top to bottom in a terminal window.
Item 5: Modify the CalcEngine class so that it calls the stackDump method if division by zero could occur, and call it anywhere else that the keySequenceError() method is called. That is, replace the keySequenceError() call with the stackDump() method call. Be sure to test this change by entering a calculation such as 1 + (2 / 0), and verifying that the correct stack contents are displayed.
Item 6: Add a '^' button to the calculator GUI interface. There is one empty spot for it. You can place it where you wish, but all operators should be grouped together. The simplest thing to do is to put '^' in the empty spot. Enable event listening for '^' and write the statements necessary for the operation to be carried out. As an overview, if 4 ^ 5 is entered, you will need a while loop that produces a result of 4*4*4*4*4. Don't forget to handle special cases like 4 ^ 0 and 0 ^ 4. Note: Java does not have a built-in integer exponentiation operator, so you should use a while loop for ^.
Item 7: There is a 'bug' in the calculator, left there by an incompetent programmer. One of the operators doesn't produce the expected result. Your job is to find it and fix it!
Copy your project to the appropriate CSC121 folder in the Project2 folder on the I: drive. Send an email message to your instructor when you have done this, naming the programmer or pair of programmers who completed the project.
Overview | Schedule | Announcements | Resources | Assignments | Home |
DePauw University, Computer Science
Department, Spring 2005
Maintained by Brian
Howard (bhoward@depauw.edu
).
Last updated