Description
1)Create a class that asks a user to input a number to divide by put the input getter in a try{} block and
catch the following exceptions:
a) If the user inputs a 0 as the divisor your code will try to divide by 0 and throw a
ArithmeticException. Catch and handle this exception and print that they have caused a
divide by 0 exception into the console (or use GUI elements if you like)
b) if the user inputs a string as the divisor your code should attempt to assign that string to
an int which will cause a InputMismatchException. Catch and handle this exception and
print that they have caused a Number format exception into the console(or use GUI
elements if you like)
2) Starting with the following file:
https://raw.githubusercontent.com/cosc1047w18/course/master/Lab4/Main.java
The program will generate 5 radio buttons with labels. There is a listener on the radio buttons
to see which one is clicked. depending on which is clicked, please cause the pertaining
exception to happen. For example, the first one is divide by 0, so in your code, write the code
that would cause a divide by 0 error.
If you need some help finding out how to cause java exceptions, look up online “Types of
Exception in Java” to help you. Lastly, for “Throw My own Exception” throw your own custom
exception.