Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in Java that converts infix arithmetic expressions into a postfix form and then evaluates the resulting postfix expression. Use linked lists for

Write a program in Java that converts infix arithmetic expressions into a postfix form and then evaluates the resulting postfix expression. Use linked lists for the data structures.You must create your own Stack and Queue class. "Logic" version: Same as above, but you will be converting and evaluating logical expressions. Here is some extra help, if you decide to take this challenge. In propositional logic, elementary propositions can be combined by five logical connectives: P <--> Q : P if and only if Q P --> Q : If P then Q (or P implies Q) P & Q : P and Q P v Q : P or Q ~ P : not P The truth tables for these logical connectives are: P Q | P <--> Q | P --> Q | P & Q | P v Q | ~ P | | | | | T T | T | T | T | T | F T F | F | F | F | T | F F T | F | T | F | T | T F F | T | T | F | F | T Logical expressions involving these connectives may combine many connectives applied according to the following operation hierarchy: all ~ are applied first next all & are applied next all v are applied next all --> are applied finally all <--> are applied Parentheses may be used to override this hierarchy. A Logical expression which always evaluates to true is called a tautology. Example: (P --> Q) <--> (~P v Q) is a tautology, because it is true for all possible combinations of true/false values of P and Q. Write a program that tells you if the expression entered is a tautology or not. Assume that you have no more than three propositional symbols in your expressions -- call them P, Q, R. Again, you must use the linked list implementation of the data structures needed. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions