Lab 10

The following exercises are to be completed during lab class.  If you do not have time to finish during lab, they must be completed before the beginning of the following lab session.  You will turn in the lab gradesheet  at the beginning of the following lab.

Before beginning the exercises, copy this lab's folder from the T: drive to your H: drive.

  1. Complete exercise 7.9 on page 387 of your textbook.  Write the resulting error on your gradesheet
     
  2. Complete exercise 7.11 on page 387 of your textbook.
    Note:  There is a small error in the documentation example: this.views.updateViews(); must be changed to this.views.updateAllViews();
    In addition you will need to add a constructor and instance data, along with some other minor changes. However, there is not a lot of work necessary to run this program, so do not make more of it than is necessary. Read the documentation carefully!
    Include the CombinationLock.java file in your zip file for submisson.
     
  3. Complete exercise 7.13 on page 388 of your textbook. Include the FuelUse.java file and your test file in your zip file for submission. 
    Clarifications: This class does two things, really: it keeps track of the total miles driven and fuel used since you got the car (or started keeping track), and it keeps track of the miles driven and fule used since the last time you reset the trip.  This is kind of like the two odometers on most cars; it just adds the keep track of fuel part as well, so it can do all of the mileage calculations.

  4. Create javadocs for your FuelUse class.  You can do this in Eclipse by going to the Project menu and choosing Generate Javadoc...  Include the resulting FuelUse.html file in your zip file.  Note that for this file to be correct, all of your javadoc comments must be correct and in the right places in the code.

  5. Complete exercise 8.7 on pages 456-457 of your textbook. Be sure to start with Becker's original code - do not waste time retyping it. (Remember you can find all example code from your text on the CD that came with it.) When testing your class you do not need to test the original methods (they have been tested by Becker in the text). Your main method only needs to test your new constructor and the toString method. Note the code for testing toString is the same regardless of which version you are testing so you do not need a different test for the first toString, the toString in part a, and the toString in part b.
    Note:   Part a requires a getName method in the Person class.
    Special Note:  You cannot have more than one toString method in your class. In this problem you are asked to code 3 different toString methods. As you write a new toString for part a and part b, comment out the previous toString so all can be graded.
    Include Person.java in your zip file for submission.
       

Use the windows zip utility to zip all required files into a single zip folder. Submit the single zip folder to your lab section under project #10 using Web Submit.

NOTE: Do NOT put your files into a folder to be zipped as this will make grading more complicated. Simply select the necessary .java files, right click, choose Send To = > Compressed (zipped) Folder.