CpSc 102, Section 1
Assignment 4
June 11, 2000
Due: Friday, June 15 by 11:59 p.m.
Assignment: Problem #5 on page 321 of text.
Total point value of assignment: 100 points
Not accepted late.
This assignment is to be done INDIVIDUALLY.
Create a file, A4.java, which will contain a main method (used for
testing your method), the method below, and any other methods you need.
public static boolean evaluateBoolean ( String str )
// post: The method returns true if the fully parenthesized
// expression in str evaluates to true; Otherwise,
// the method returns false.
This method is required to work correctly for fully parenthesized
boolean expressions such as the examples below.
( 3 < 35 ) or (3<35)
( 123 <= 123 ) or (123<=123)
( 75 > 15 )
( 75 >= 15 )
( 100 == 1000 )
( 115 != 75 )
( ! ( 3 == 7 ) )
( ( 72 > 0 ) || ( 11 < 3 ) )
( ( 203 >= 203 ) && ( 1059 == 1059 ) )
( ! ( ( 2222 < 1039 ) || ( 35 != 17 ) ) )
( ( ! ( 2222 < 1039 ) ) || ( 35 != 17 ) )
and more complex expressions of this type
All operands will be non-negative integers. Do not assume that all
operands, operators, and parentheses will have spaces separating them
from other operands, operators, and/or parentheses. Any negative sign
that is encountered will be a binary operator.
Your main method should (as usual) contain a test program, containing several test situations. A4.java may contain any additional methods that would be helpful. For example, you might write a method to print out "CPSC 102", your name, the assignment number, and a brief description of the assignment.
Other requirements:
The first operation of your main program must be to print "CPSC 102", your name, the assignment number, and a brief description of the assignment.
Follow the style standards to be found on your instructor's
web page for CPSC 102.
Submit your program using the handin command. There is a link to
the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
In the opinion of the instructor the program is an honest attempt
to complete the assignment as described 5 pt.
The program compiles without error. 10 pts.
If the two previous requirements are not substantially met, no further
points will be awarded.
Correctness, documentation, style, and quality of test program. 85 pts.
Points will be subtracted for failure to follow style standards.
The grader's test program will first test the examples above in
the order in which the examples are given. When testing a method
causes the test program to fail (exit), no further testing will be done
on your program and your grade will not be as high as you think it
should be. To help avoid an early failure of the test program,
please test your program fully.
Handling the test data as special cases is not acceptable.