Homework 9 for Computer Science 125

Introduction to Computer Science

Boise State University, Spring 1999


This homework is due by 9 p.m., Friday, 30 April 1999. See the directions in Homework 1 to electronically submit homework.

Warm-up and Practice Problems

These are not be turned in. They are to help you understand the material, and some will appear on exams.

Graded Problems

You must comment your code (see book for examples).
You must include comments for all functions, following the javadoc format. See CCJ, p 183-185 for more details.

    P26. (Appointments) Write a class to store appointments. Your Appointment class should store the beginning and ending time of the appointment, and a short description of the appointment (stored as a string). The Appointment class should also contain the following constructors: and the following accessor and mutator methods: Write a program that demonstrates that your class works. Have your program ask the user for an appointment, store this in an Appointment object, and then print out the appointment.

    Your program should:

    1. Ask the user for the beginning time of the appointment. The time will be entered as 6 integers representing the year, the month, the day, the hour, the minute, and the second of the beginning time.
    2. Ask the user for the ending time of the appointment. The time will be entered as 6 integers representing the year, the month, the day, the hour, the minute, and the second of the ending time.
    3. Ask the user for a short description of the appointment. Note that this could consist of several words, so, you should read the entire line, instead of a single word.

    You should include comments for each of your functions that can be used by javadoc to generate documentation (see notes from class or Appendix A for more details about using javadoc). This class will be used later for a daily planner program-- which will use the above methods. The current program should be console-based.

    Submit this as program 26 using the electronic submission. Please call the file (and the class) Program26.

    Program 27 is cancelled, due to system difficulties!

    P27. (Animation) Modify animate.java to allow the user to control the length of time the images are seen on the screen. You should have a choice button with the choices: "fast", "medium", and "slow." Include start and stop buttons that will start and stop your animation. For example:

    Submit this as program 27 using the electronic submission. Please call the file (and the class) Program27. Include an HTML file in the directory called Program27.html that displays your applet and any images your applet uses.

    P28. (Puzzle) Write a class called PuzzleBoard. PuzzleBoard should store 15 PuzzlePieces (see Homework 7, P19) and include the following methods: Your class should use the PuzzlePiece class written for P19.

    PuzzleBoard will be called by Program28.java. For more information and hints, see here.