Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: Implement a concrete ArrayStack class that extends the IStack interface as we discussed in the class (any other different Stack class implementation, even if

Requirements: Implement a concrete ArrayStack class that extends the IStack interface as we discussed in the class (any other different Stack class implementation, even if it is implemented by yourself, will not receive any credit). Write a test class called Evaluate and a method that evaluates an arithmatic expression, which is given by a string. import java.util.Scanner; public class Evaluate { public static void main(String[] args) } // your implementation // obtain user's input from keyboard // invoke method expression() to get the result and print it out } public static int expression(String str) { // return the value } } Your implementation is required to use the IStack interface we discussed in the class. provide a necessary test case to verify the result. For example, 14-3*4+2*5-6*2 (should return 0) In another example, 14-3*(4+2*(5-6))*2 (should return 2) You may want to test all possible corner conditions to make sure your implement is inclusive. Your implementation only considers +, - and * operators, as well as the parentheses (), and does not need to consider other operators and brackets. In particular, your code should not work with division operator "/". Grading Criteria: Please make sure your program compiles, otherwise your submission will not be graded and you will receive zero. Point deduction rule: Compile warning: 3 points each. Minor error: such as not meeting the assignment input/output requirement, 5 points each. Major error: examples include, infinite loop, runtime errors, any runtime exception, 15 points each. Any code not compliant to the assignment requirement (e.g., not using IStack interface or ever using generic programming) will not be graded and you will receve zero. 20 point penalty if your program works with division operator "/". (40%) Correct implementation of IStack.java, ArrayStack.java and StackFullException.java. (40%) Correct implementation of Evaluate class with the expression method that correctly evaluates the expression with +, - and * operators. (10%) The above expression method supports the parentheses (). (10%) Correct README file (with the required contents).

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 For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

ISBN: 3031001257, 978-3031001253

Students also viewed these Databases questions