600.108 Intro Programming Lab, Fall 2017, Week 10

Getting Started: If you were not in your regular lab section last week (or are not this week), please ask the lab leaders who your partner should be. Do the posted Blackboard poll. Your lab leaders will review the answers before you get started on this week's exercise. Also remember to have a lab leader check your work after each phase.

This week you will be writing a set of 4 classes (using inheritance) and implementing an interface to support a personal planner application. Only put the minimal amount into each class, so that they will adequately support each other and main. The driver program is already written for you and posted on the course website, but you may make changes if you want. There is also a Time class on the course website that you should use! You do not have to make either of these files checkstyle compliant, but the classes you implement below should be.

The Problem: Personal Planner

The ultimate goal is to create a Planner class to define objects that can hold different kinds of jobs that you need to do. The simplest type of job is a Task, such as laundry or haircut, etc. The next level of job is essentially a task that has a deadline (called DueDo in this system). Each one of these, in addition to the actual job (such as "doing Java homework") has a deadline which consists of a date and time. The third level is an Appointment which is something to do, at a specific date and [start] time, that also has a location and expected end time.

Step 1) Read through the coding phases below, and then draw a UML-like diagram with all the classes and interfaces your solution will use and the relationships between them.

--- Switch driver/nagivator roles ---

Step 2) Create a base Task class which can be used to create objects that represent things to do. Include a read method which gets pertinent info from the keyboard. Get this to compile with the relevant parts of the driver program (comment out the other parts).

--- Switch driver/nagivator roles ---

Step 3) Create a DueDo class which extends the Task class by adding members related to a deadline (time and date). Remember to use the Time class! For simplicity, just use Strings to represent dates. Get this to compile with the relevant parts of the driver program.

--- Switch driver/nagivator roles ---

Step 4) Create an Appointment class which can be used for appointments consisting of a location, a date, a start time, and an end time. Optimize code reuse with your choice of which class to extend. Get this to compile with the relevant parts of the driver program.

--- Switch driver/nagivator roles ---

Step 5) Download the Database interface from the lab webpage (www.cs.jhu.edu/~joanne/cs108/Database.java). [Note: this file might differ somewhat from the interface used in classwork or homework.] Now create a Planner class which implements this Database interface and contains an array of Tasks. Your Planner should be implemented such that it holds at most 1000 things at any given time. Get this to compile with the full driver program.

Step 6) CLEAN-UP: Email your solution to both partners, submit on Blackboard as usual, and then clean-up any local files as usual. Failure to do so constitutes an ethics violation.

Have a great Thanksgiving Break!!