Write User Defined Exception Class Named Oddexception Print Message Number Must Even B W Q11970387

a. Write a user defined Exception class named OddException thatwill print with the message “Number must be even”.

b. Write a program to determine the sum of all even integers ina list enter by the user. The program should prompt the user toenter the integer. If the user enters an odd value, then anexception, OddException exception (defined in part a), should bethrown and caught. The user will then be prompted to enter thevalue again until an even value is entered.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *