Question: You should use the .java file provided here, modify it appropriately, and upload your solution. You may modify anything you like, but it has a

Input format Your program should read from standard input (i.e. System.in). It will write to standard output (i.e. System.out). This is the way ALL of our projects will be, unless otherwise indicated. Each input will consist of one trace. Each line of input will contain either a call or a return, followed by a space, followed by the name of the function. The name of the function may not contain whitespace. When comparing two function names to see if they match, case IS important. Program output Here are the outputs your program may produce: Valid trace Maximum call depth was DEPTH for valid traces, and the output of Invalid trace at line LINENUMBER followed by one of the following: Returning from FUNCTION1 instead of FUNCTION2 Returning from FUNCTION which was not called Not all functions returned followed by a stack trace. The difference between the first two errors is whether any functions are on the stack. See (and use) the executables below for details. Your program should produce only one of these statements per document. In addition, if the trace is invalid, your program should produce the stack trace (the functions on the stack when the error is detected), one line per function. If there are multiple errors, print only the first one detected (earliest in the input). The terms in all-caps are defined as follows: DEPTH: the number of items on the stack LINENUMBER: the line number of the input (where the error is detected) FUNCTION1, FUNCTION2, FUNCTION: names of functions (FUNCTION1 is the function that is trying to return, while FUNCTION2 is the function on top of the stack)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
