Question: this is java program thank you Method File - Class ExceptionHandlingInputOutput ExceptionHandlingInputOutput openFile(filename: String): double saveFile(filename: String, radius: double): void Method Open File reads a
this is java program thank you
Method File - Class ExceptionHandlingInputOutput
| ExceptionHandlingInputOutput |
|
- Method Open File reads a double from that file and returns the value. Declare the method so that it will automatically detect and throw exceptions.
If this is your input file then it indicates that the Radius is 1.23
1.23
- Method Save File gets the Filename and Radius from the user. The method write the value of Radius to the Filename specified. If the Radius is zero then throw an Illegal Argument Exception with the message "Radius is zero". If the Radius is negative then throw an Illegal Argument Exception with the message "Radius is negative".
If the Radius is 2.345 then your file will be:
2.345
Main File - Class LabActivityExceptionHandling
- Declare any required constants.
- Declare any required variables
- Declare any required objects.
- Create a comment Catching Exceptions Call method Open File with a filename that does not exist (display the exception information to the screen). Call method Save File with a Radius that is equal to 0 (display the exception information to the screen). Call method Save File with a Radius that is negative (display the exception information to the screen).
- Create a comment Valid Method Calls Call method Open File with a filename that exists and contains a valid value for Radius. Call method Save File with a Radius of 14.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
