Write a method
named recordExceptions that accepts an instance of the Faulter
class. Faulter objects have a fault method, which takes no arguments, but
the first N times that it is called on a Faulter instance, it will throw some
kind of exception. After that point, it will return an Int.
Your solution should repeatedly call fault until it returns a value, and then you should
return that same value. However, every time fault throws an exception, on a new line you should
print the attempt number and exception type. If, for example, you are on attempt 5 and fault throws
an IllegalStateException, you should print "Attempt 5: Threw IllegalStateException".
Your first attempt should be attempt 1, NOT attempt 0.
Note that given some exception e, e.javaClass.name will return the exception type.
For example, if e was an IllegalStateException, e.javaClass.name returns "java.lang.IllegalStateException".
You will need to modify this slightly for your output.
Stuck? You may find these lessons helpful: