• Home
  • Blog
  • Java Question, computer science homework help

Java Question, computer science homework help

0 comments

This is a three part project:

  1. Implement the stack interface that I have attached as both a dynamic size array and as a linked list.
  2. Implement functions to convert one type of notation to any other type (eg infix to prefix).
  3. Implement an expression evaluation function.

You should write a driver program called ‘XFixDriver.java’ which prompts the user for the type of notation that he would like to enter, followed by the notation he would like to to convert to.

Particulars

Possible Conversions

There are six possible user requests:

  1. infix to postfix
  2. infix to prefix
  3. prefix to infix
  4. prefix to postfix
  5. postfix to infix
  6. postfix to prefix

Note: Implement all of these as separate functions. Don’t use intermediate conversions.

Variables

All variables should be single chars A-Z or a-z. If anything else is processed, then the expression is illegal and you should report it as such.

Operators

The only operators that you should process: +,-,*,/,^

Any other operator found should cause an illegal expression to be reported.

Parens and Brackets

You are expected to process infix notations that have (),[],{} groupings. If you encounter any kind of missmatch, then you should report the illegal expression.

Driver

What type of expression would you like to enter:

1) Infix

2) Postfix

3) Prefix

0) Quit

Enter expression:

What would you like to do:

1) Convert to infix

2) Convert to prefix

3) Convert to postfix

4) Evaluate Expression

5) Return to Main Menue

0) Quit

Test Cases

As with all our projects, you are expected to generate your own test cases. Think about all the possible edge cases. Consider mismatched parens or brackets, invalid operators and invalid variable names.

Follow the style sheet provided below !!

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}