In Java Language Write a complete method and an exception class to accomplish the following: the method takes two integers as parameters if both numbers are not zero, the average of the numbers is printed if either number is zero, an error message is printed use exception handling in your code to accomplish the task PART A: Write your own exception class to be used in PART B. public void printNonZeroAverage(int x, int y) { PART B: YOUR CODE HERE } Thank you! Solution ZeroException.java public class ZeroException extends Exception{ String str1; public ZeroException(String s){ this.str1 = s; } public String toString(){ return (str1) ; } } NumberCalc.java import java.util.Scanner; public class NumberCalc { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println(\"Please Enter 1st value : \"); int firstValue = scan.nextInt(); System.out.println(\"Please Enter 2nd value : \"); int secondValue = scan.nextInt(); printNonZeroAverage(firstValue, secondValue); } public static void printNonZeroAverage(int x, int y) { //PART B: YOUR CODE HERE try{ if(x != 0 && y != 0){ double avg = (x + y)/(double)2; System.out.println(\"The Average of Two Numbers is : \"+avg); } else{ throw new ZeroException(\"Error: x and y values should not be ZERO\"); } } catch(ZeroException exp){ System.out.println(exp) ; } } } Output1: Please Enter 1st value : 5 Please Enter 2nd value : 6 The Average of Two Numbers is : 5.5 Output2: Please Enter 1st value : 5 Please Enter 2nd value : 0 Error: x and y values should not be ZERO .