Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: The goal of this assignment is to practice implementing stacks. Background: A mathematician hires you to write a program that can compute some expressions

image text in transcribed
Objective: The goal of this assignment is to practice implementing stacks. Background: A mathematician hires you to write a program that can compute some expressions written in postfix form Assignment Specific instructions are as follows 1. Write a class for a stack using a linked list. The stack class must have the name GenericStack. You must write regular stack methods (including createStack, isEmpty push, pop, popAll, peek, and size) in the GenericStack class. Stack content must be of object type (that is, the stack can store any data type). Create any other class necessary for the linked list node 2. Write a class named Evaluator. The Evaluator class is the only class that will contain the main method. The Evaluator class will prompt for an input file and read the file line by line. Each line of the file will contain a postfix expression as an input. In the lecture session, we have already seen how we can compute a postfix expression using a stack. Use a GenericStack object to compute the value of each expression your program will read from the input file. The actual evaluation must be done in the Evaluator class. GenericStack is the data structure that will be used to evaluate an expression. Report the result for each expression on the terminal. Some expressions may be incomplete; report an error for those expressions An example line from an input file is provided below 6523+8+3 +* If you compute (evaluate) this postfix expression, it will result in 288 An example of an incomplete expression is as follows: 652 3+83+ You will not be able to complete the evaluation of this expression; you must report that the expression is incomplete Comment: Each operand and operator in an expression will be separated by spaces in the input file .You are NOT allowed to use java LinkedList class (that is. the use of java.util.LinkedList is prohibited.) You must use your own linked list node Deliverables: You are expected to submit more than two Java files (GenericStack.java, Evaluator.java, and any other file(s) to support your linked list) using Blackboard. Your T/A will instruct you with further details

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Agree a review date to discuss progress.

Answered: 1 week ago

Question

Question What are the requirements for a safe harbor 401(k) plan?30

Answered: 1 week ago