600.108 Intro Programming Lab, Fall 2017, Week 12

Getting Started: This is our last week! Please work with the same partner as in week 10 (Planner classes) if possible, since this week's project will be an extension of that. Do the posted Blackboard poll (week 12 quiz and survey) before getting started on this final problem. It will take a little longer than usual - your thoughtful feedback is appreciated!

The Problem: Personal Planner Exceptions

For this final week you'll be putting some actual error-checking with exception handling into code. To start with, get with your partner from last week and download our posted solution files for the lab from week 10. Some of the instructions below are intentionally vague for this week. We want you to really think about error situations that might occur and the best ways to handle them as if this were a real app you were going to launch.

Step 1) Create a custom exception class called BadTimeException that extends Java's RuntimeException class. Then edit the Time.java class definition to use it when invalid data would otherwise create bad times in the Time class. You should also use appropriate Java API classes to handle other types of exceptions that might be thrown in the Time class, for example when converting a String to an Integer in the constructor. The code you write in this step should be similar to the InvalidCardException and Card.java updates that we saw in lecture this week. Test and show to your lab leader.

--- Switch driver/nagivator roles ---

Step 2) Create a new driver program called PlannerExceptions.java that starts as a copy of PlannerDriver.java. Handle all possible Java IO exceptions in main, particularly those that might be thrown from the read methods of your other classes. See the exceptions*.java files from lecture for examples like this. Test and show to your lab leader.

--- Switch driver/nagivator roles ---

Step 3) Next, systemmatically go through each of the various Task related classes (Task, DueDo, Appointment) and identify places where exception handling would be appropriate. Use the BadTimeException class to handle invalid times in these classes where they are creating Time objects. Add code to anticipate any handle any other possible issues that you've identified. Test and show to your lab leader.

--- Switch driver/nagivator roles ---

Step 4) Handle attempts to put more than the MAXSIZE limit on how many items can be in a Planner object using exceptions. How you do this is entirely up to you. Test and show to your lab leader.

--- Switch driver/nagivator roles ---

Step 5) Congratulations -- you have completed the Java Lab Course! Email your solution to both partners, submit on Blackboard as usual, and then clean-up any local files as usual. Also, don't forget to fill out the campus-wide course evaluation, available through SIS. Thank you!!