Write a class InvalidCNICException that extends Exception class. The class should have the following details implemented A
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a class InvalidCNICException that extends Exception class.
The class should have the following details implemented
–A message property.
–override the following method that returns a message
String to String()
–Two constructors
1. With no parameter
2. With String parameter
Take user input for CNIC. The CNIC is considered valid if
1. The length of CNIC is 15(including -)
2. if the hyphen(-) is present at position 6 and 14.
Generate (throw) Invalid CNIC Exception when an invalid CNIC has been entered by the user. Handle this exception by giving the user a responsive message saying "The CNIC you entered is not valid"
SOLVE THIS IN JAVA LANGUAGE.
Related Book For
Statistics for Business and Economics
ISBN: 978-0132930192
8th edition
Authors: Paul Newbold, William Carlson, Betty Thorne
Posted Date: