Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having trouble with the logic of this program assignment. If you decide to

ID: 3681122 • Letter: I

Question

I am having trouble with the logic of this program assignment. If you decide to post the whole program, there needs to be in separate methods(as many as are needed), and a decent explanation of what is going on within the code. This is java programming. Thank you so much for whatever help comes(:

You are always running into trouble with mismatched braces in your Java programs, and decide to write a program that will help you to find your errors (if only you can match the braces so THIS one will work!). The program will read any number of lines of text. It will output the same text, but with numbers inserted after each opening and closing brace that will help you to match them up. Each opening brace will be assigned a number consecutively based on the current number of unmatched opening braces. Each closing brace will be given the same number as the matching opening brace. If a closing brace is encountered when there are no unmatched opening braces, it will be labeled with a 0. The input to this program is the file to be processed and your program MUST first attempt to read that file from command line arguments. Be sure that your program is designed robustly and does not crash if the user forgets to enter the file name when running the program or if the file is not present, or other silly user error occurs. The output will be the lines of text with the braces numbered.

Explanation / Answer

import java.io.File ; import java.io.FileReader ; import java.io.IOException ; /** * Development driver for Assignment #4, matching brackets. * * @author lou * @param args[0] * name of a file to check */ public class Assign4 { public static void main(String[] args) { /* * Check that the user has supplied a file name, and that the file * exists and is readable. */ if (args.length