Question: Please Help with #4 the file will be read from the file. The code I have: import java.io.File ; import java.io.FileNotFoundException ; import java.util.ArrayList ;

Please Help with #4 the file will be read from the file.
The code I have:
import java.io.File ; import java.io.FileNotFoundException ; import java.util.ArrayList ; import java.util.EmptyStackException ; import java.util.List ; import java.util.Scanner ; import java.util.Stack ;
public class Driver {
/** * @param args the command line arguments */ public static void main(String[] args) { //path to the text file String path = "src\\package\\expression.txt" ; //create new file object File file = new File(path) ; //operands List operators = new ArrayList() ; //add all operators to Arraylist operators.add("+") ; operators.add("-") ; operators.add("*") ; operators.add("/") ; //try statement try { Scanner scan = new Scanner(file) ; String input = scan.nextLine() ; String[] tokens = input.split("\\s") ; try { Stack stack = new Stack() ; //for loop for(int i = 0 ; i 1. Creation of project5. Package should include the driver and driver test classes /10 1. Input a. Project reads expression files........ b. Project correctly recognizes numbers as double c. Project correctly recognizes arithmetic operators. /5 15 /5 2. Output a. Calculations return the correct answer b. Program handles division by 0 c. Program returns error for too many operators. d. Program returns error for too many operands. /10 75 /5 /5 3. Calculations & Implementation a. Addition b. Subtraction c. Multiplication d. Division... e. Use of Stack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
