Menu

[Solved]5 Objectives Assignment Enhance Knowledge Skill Java Gain Understanding Experience Stacks Q37204196

5. The objectives of this assignment are to:

  1. Further enhance your knowledge and skill in Java.
  2. Gain an understanding and experience with stacks.
  3. Gain further experience using generics.
  4. Continue to practice good programming techniques.

Create a stack class named MyStack that stores generics with themethods shown below. Write a test program that thoroughly testsyour stack implementation.

void push(E item)

push item onto top of stack

E peek()

return item on top of stack

E pop()

return item on top of stack and remove it from the stack

boolean isEmpty()

returns whether or not stack is empty

Once the stack is working, create a class EvalPostfix thatreceives a postfix expression in String format,uses the MyStack class to evaluate the expression, and returns theresulting value. You may assume that all operands and operators (+- * /) will be separated by a single space. Operands will beintegers and may contain several digits. The class will require thefollowing functions to be implemented:

EvalPostfix(String post)

constructor that sets the attribute containing the postfixstring to be evaluated

int eval()

returns the result of the postfix expression

Write a test program named Prog5 that gets a postfix expressionfrom the keyboard, uses EvalPostfix to evaluate the expression, anddisplays the result.

Requirements

  • Your source code should abide by the Java programming standardsfor the course.
  • Your source code should be documented using Javadoc styleaccording to the course standards.
  • Use the default package in your project; do not specify apackage in your code.
  • Use any file and class names specified in the assignment.
  • Your test program must be named Prog5.

Expert Answer


Answer to 5. The objectives of this assignment are to: Further enhance your knowledge and skill in Java. Gain an understanding and… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *