Lab 9
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.
You will complete a debugging quiz during lab today. For it,
you will need the Student.java and StudentInfo.java files from the T:
drive. Set up a project containing those files so that you are ready to
go when the lab instructor or assistant comes to you.
-
Complete exercise 7.6 on page 387 of your textbook.
Note: The Name class has no attributes and the default constructor is
simply a call to super();
Add a main method to the Name class that tests your methods. Include Name.java
in your zip file for submission.
-
Complete exercise 7.7 on page 387 of your textbook. Name the class
MultTable.java. Use nested loops to calculate and print
the table.
Note: To print integers using the printf method you will use "d" not "i"
in the first parameter. For example: "%10d" would print an integer right
justified in a 10 character column.
Include the MultTable.java file in your zip file for
submisson.
-
This problem and the next have been postponed to next week's lab. If you have time, feel free to work on it and get a head start, but do not submit with lab 9.
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.
-
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.
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 #9 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.