1. In Figure 6.5 on page 330, we presented a program to evaluate arithmetic expressions. In this exercise, you will write a similar program to evaluate boolean expressions. Rather than arithmetic operations, the input expressions for this program will use the operations && (the “and” operation), || (the “or” operation), and ! (the “not” operation). Rather than combining numbers, the input expression will combine simple boolean comparisons of numbers such as (1 <><><=,>=, ==, and !=. At first assume that all boolean expressions are fully parenthesized and well formed. Be sure to note that “not” is a unary operation. You can assume that the argument to “not” (which follows the !) is enclosed in parentheses. Your program should allow the user to evaluate additional expressions until the user wishes to end the program.
For a more difficult assignment, enhance your program by adding any or all of the following features: (a) The numbers need not be integers. (b) The expression need not be fully parenthesized, and if parentheses are missing, then the Java precedence rules apply. (Note that innermost expressions such as (1 <>
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here