CSCI 202 Homeworks 7 and 8


To really understand a program that uses the Java Collections Foundation.

Homework 7


Start out with the Google Docs document of the expression evaluator code. Make a copy for your own use and share it with the class instructor.

You are allowed to work with one other person on this homework, but the people working together must be approved by the course instructor.

The assignment

Carefully read and study the program. Presently, it has very few comments. As you read the program, make notes about what it is doing and place them into the code as Java comments. Color the text of your comments red to make them stand out.

As you read the code, make a list of all the Java features you do not understand and place this list at the end of the program. This information will influence what gets covered in the course.

Due date

Because you have shared your document with the instructor, he will may be looking at it from time to time. He may even comment on your progress. Sometime on the Ides of March, the instructor will copy your document and start grading.

Homework 8


Create a spreadsheet within Google docs and share it with the class instructor.

Again, you are allowed to work with another person but that person must be approved by the course instructor and cannot be the same person you worked with for Homework 7.

The Assignment

There are four major stack-processing methods in the program: string2infix, syntaxCheck, infix2postfix, and doPostfixEval. Each of these methods has a large while loop containing most of the method’s Java statements. During these loops elements are pushed on and popped from stacks. In some loops, two different stacks are being manipulated.

Assume that evaluateExpression is called with the String "13+(15+17)*23". In this case, either nine or seven (for doPostfixEval) iterations will be made of each method’s main while loop.

That’s thirty-four iterations in all. For each of the thirty-four iterations, write the contents of the stacks that are being changed during the loop. Additionally, write the contents of the stacks at the end of the loop. That makes thirty-eight execution points where stack contents must be written. Because syntaxCheck and infix2postfix are changing two stacks, you ll be writing fifty-eight different stacks.

This shouldn’t be that hard because you will be able to cut-and-paste quite a lot.

Due date

On March 19 your spreadsheet will be copied for grading.