writing Custom exception and its implementation
can somebody help me writing a custom exception class
checkDateException and also how to use that class in PatientDateVerifier where the
scenario goes like this.............
Description: This class is a checked exception class.
Constructor: public CheckDateException(GregorianCalendar checkDate,
Description: Saves checkDate and msg to the class’ instance
Method: public String toString()
Description: Concatenates the String value of checkDate and msg.
Description: This class will be used to verify a patient’s checkup
Constructor: public PatientDateVerifier()
Description: Creates an instance of the DateValidator class.
Method: public void verifyCheckUpDate(GregorianCalendar checkUpDate)
Description: If checkUpDate is a future date, it throws an exception
message: Remarks:\nInvalid date: Check-up date is in the future.
If checkUpDate is older than six months, it throws an exception
with the message: Remarks:\nCheck-up date is longer than six
months.\nPatient needs another checkup.
If checkUpDate falls in the month of December, it throws an
exception with the message: Remarks:\nPatient needs smallpox
Any help or suggestion is appreciated.
Thanks and regards