(Solved) : Task Read File Containing Arithmetic Instructions 3 44 107 11 Instruction Contains Integer Q42685222 . . .

Your task is to read a file containing arithmeticinstructions such as

3 + 44 – 107 * 11

Each instruction contains an integer, an operator (+, -,or *), and another integer.

Return an array list of the results. If there is anyerror, throw an IOException.

Arithmetic.java

——————————————————————————————————————-

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Arithmetic
{
/**
This class reads a file containing arithmetic expressions andreturns an
array list of the results.
@param filename the file name
@return a list of results
*/
public static ArrayList<Integer> read(String filename) throwsIOException
{
. . .
}

// This method checks your work. Do not touch it.

public static String check(String filename)
{
try
{
return read(filename).toString();
}
catch (IOException ex)
{
return “I/O exception thrown”;
}
catch (Exception ex)
{
return ex.getClass().getName();
}
}
}   

Expert Answer


Answer to Your task is to read a file containing arithmetic instructions such as 3 + 4 4 – 10 7 * 11 Each instruction contains an …

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us