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

Write a program that prompts the user for a file name, assuming that the file co

ID: 3540887 • Letter: W

Question

Write a program that prompts the user for a file name, assuming that the file contains a Java program. Your program should read the file and print its contents properly indented. When you see a left-brace character({) in the file, increase your indentation level by four spaces. When you see a right-brace character(}), decrease your indentation by four spaces. You may assume that the file has only one opening or closing brace per line, that every block statement(such as if or for) uses braces rather than omitting them, and that every relevant occurrence of a { or } character in the file occurs at the end of a line. Consider using a class constant for the number of spaces to indent(4), so that it can easily be changed later.

Explanation / Answer

please see here http://pastebin.com/C3iVM949

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote