Assume you have class AutoFactory with two static methods called shutdown and reset. Neither method has any parameters. The shutdown; method may throw a ProductionInProgressException. Write some code that invokes the shutdown method. If a ProductionInProgressException is thrown, your code should then invoke the reset method. The argument to a square root method (sqrt) in general should not be negative. Write the definition of a class named SQRTException whose objects are created by specifying the original negative value that caused the problem in the first place: new SQRTException(originalArgument). The associated message for this Exception should be "Bad argument to sqrt: " followed by the value specified at the time of instantiation. Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the process method may throw one of several exceptions. One of these is NumberFormatException, another is FileNotFoundException. And there are others. Write some code that invokes the process method provided by the object associated with processor and arranges matters so that if a NumberFormatException is thrown, the message "Bad Data" is printed to standard output, and if FileNotFoundException. is thrown, the message "Data File Missing" is printed to standard output. If some other Exception is thrown, its associated message is printed out to standard output.

Respuesta :

The shutdown method is called using the code shown below. If a ProductionInProgressException is thrown, the reset method should be called.

Coding Part:

try {

AutoFactory.shutdown();

} catch (ProductionInProgressException e) {

AutoFactory.reset();

}

What is Method in Programming?

A method is a procedure or function associated with a class in the context of object-oriented programming. A method defines a specific behavior of a class instance as part of a class. A class can have multiple methods.

Methods are present in all object-oriented programming languages. In other programming languages, such as C, SQL, and Delphi, methods are similar to functions or procedures.

An object method can only access data that the object knows about. This preserves data integrity between sets of objects in a program.

To know more about Method in Programming, visit: https://brainly.com/question/17205678

#SPJ4