for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { sum++; } for (int j = 0; j < n; j++) { sum++; } }Exact answer = ______, giving an asymptotic answer of O( ______ ). (5 Points Each)
Pass into the method a BigRational object. Evaluate the object to determine if it is equal to its own absolute value. If it is, print the message "Good going", and terminate the program (or at least exit the method). If it is not, print the message "Not good going", and terminate the program. Regardless of the outcome of this test, print the message "Done" before terminating.
Write this code twice: once using if-then-else block(s) to evaluate the data and handle a possible error, and once using a try-catch block to evaluate the data and handle a possible error. When using a try-catch block, use a "throw" statement to throw an exception for each case and handle that case within the catch block; you are allowed to use an if statement within the try-catch, but you should not print within the if statement. (20 Points Each)
Note: This code would never be written using a try-catch block in a production environment, nor do we typically both throw and catch exceptions in the same method; we do it here to make sure you understand important structures.