Assignment #4 - Exceptions
Due Problem #5 on p. 577
What to assume:
Input will be of the form mm/dd/yyyy , that is, there will be 2 digits
followed by a slash followed by 2 digits a slash and 4 digits. You must
use a BufferedReader to complete this assignmed. You should check for a
DayException first , then a MonthException, and finally a
YearException. Your program *should* throw multiple exceptions if the
situation arises. See the sample input/output below:
Please Enter Date:
<---- Program output
12/23/1976
<--- User input
The Date is December 23, 1976
<--- Program output
Please enter Date
<--- Program output
14/99/5003
<--- User input
Error. Bad Month! Must be between 1 and 12
<--- Output from
Exception
Error. Bad Day! Must be between 1 and 31
<---- Output from Exception
Error. Bad Year. Must be between 1000 and 3000
<---- Output from Exception
Please re-enter
<---Program output. Note
this only appeared once (even with three exceptions)
10/44/1987
<--- User input
Error. Bad Day. Must be between 1 and 31
<----Output from Exception
Please re-enter
<--- Program output
06/03/2001
<--- User input
June 3, 2001
<--- Program output
Some things to note:
- The program loops infinately
- You don't need to check for valid day/month combinations (for
example 04/31 would be fine)
- Your output should look as close to the sample above as you can get
it!