CS 201 - Computer Science I - Fall 2004
Lab 5 - if statements


Loyola College > Department of Computer Science > CS 201 > Labs > Lab 5

Due

Electronic Submission: Monday, October 25 at 11:59pm. Labs submitted one day late will be assessed a 20% penalty. Labs will not be accepted more than one day late.
Write-up and print out: Wednesday, October 25 at the beginning of class

Objectives

Introduction

Recall that the LibraryBook class from a previous example had fields for title, author, borrower, and due date. This class has been updated to include two more fields: call number (a String), and replacement cost (a double). The constructors have been updated to work with these new fields. We will also add several methods that use these fields and the original fields. The new methods will use conditionals (if statements).

Assignment

First change the name of LibraryBook.java to LibraryBook<LastName1><LastName2>.java and change the name of BookTest.java to BookTest<LastName1><LastName2>.java.

Then add the following methods to the LibraryBook<LastName1><LastName2> class. (Some of these methods will crash when called on a book that is not checked out; that is OK for now).

Finish the test driver started in the BookTest<LastName1><LastName2> class. Your test driver should test all the cases of the methods described above. For example, to test isReference you would display the result of calling isReference on a reference book and a non-reference book. Part of your grade for this lab will depend on how completely you test your class.

Individual Write-up

In this write-up, you should begin by drawing a flow-chart for each of the three methods that you wrote. Then using the flow-chart and the code, explain how your test driver completely tests all your code. You should indicate which code is run by which test cases and argue that you have executed all the code and checked all the cases necessary.

This write-up will be graded for quality of writing and use of technical terms. Sophistication of the write-up will also be accessed.

Grading

Files

Submissions

Submit the source code for the LibraryBook<LastName1><LastName2> class with your additions as well as the source code for the BookTest<LastName1><LastName2> class using the class submission page. Turn in a print out of your code and write-ups in class.