Project 2
Library Books
Due: Mon., March 5, 8 AM
Submit Project: Proj2
Required Files: Proj2.java, Book.java
Grading Header: header.txt
Having completed a project that uses simple arithmetic expressions, we
will change directions for a moment to work on
your knowledge of building and using classes.
You will also be required to do some
basic problem solving, as
well as basic output.
Program Description
With this program you will begin to design a library system. As you know a
library is made up of books, so the first thing we need to do is design a class
for handling books. For this project in addition to writing the class Book,
we will also write a driver program to test our implementation of Book.
Project Specifications
- Your program must be in a file named
Proj2.java and your
book class should be in a file called Book.java.
- In Book.java you must declare instance variables for the title, author,
publisher, copyright date, ISBN number and a boolean called checkedOut which
should be set to false to start.
- You must implement a constructor method which takes five parameters that
will be used to initialize the uninitialized
instance variables (title, author, publisher, copyright date, ISBN number).
You will also need to build
accessor and mutator methods for
all six instance variable, and a toString method that returns a nicely formatted,
multi-line description of the book.
- Processing Specifications:
- Your main program should start by
creating and initializing 3 book objects. Use the following data for the 3
books:
-
Java Software Solutions, Lewis and Loftus, Addison Wesley, 2005,
0-321-32203-4
- Computer Science An Overview 8th edition, J. Glenn Brookshear,
Addison Wesley, 2004, 0-321-24726-4
- Programming Languages Principles and Paradigms, Tucker and Noonan,
McGraw-Hill, 2002, 0-07-238111-6
- Print out the information about each book. (toString)
- Change the copyright date of the 2nd book to 2005.
- Change the title of the 3rd book by adding a colon after the word
Languages. In addition add a "," after the title and add 2nd edition to
the title.
- Change the copyright date of the 3rd book to 2007.
- Change the title of the 2nd book by adding a colon after the word Science
and a comma after Overview. Also make it the 9th edition.
- Change the author of the 3rd book to Allen Tucker and Robert Noonan.
- Change the isbn number of the 1st book to 0-321-32203-7.
- Change the author of the 1st book to John Lewis and William Loftus.
- Change the check out status of the 3rd book to checked out.
- Print out the new information for all three books. (toString)
- Print out the title and copyright date of the 1st book.(accessor methods)
- Print out the title,author, and copyright date of the 3rd book. (accessor methods)
- End the program
Output Specifications
There is no keyboard interaction with this driver program so all you will get
is output which should look like:
Title: Java Software Solutions
Author: Lewis and Loftus
Publisher: Addison Wesley
Copyright date: 2005
ISBN number: 0-321-32203-4
Checked out status: false
Title: Computer Science An Overview 8th edition
Author: J. Glenn Brookshear
Publisher: Addison Wesley
Copyright date: 2004
ISBN number: 0-321-24726-4
Checked out status: false
Title: Programming Languages Principles and Paradigms
Author: Tucker and Noonan
Publisher: McGraw-Hill
Copyright date: 2002
ISBN number: 0-07-238111-6
Checked out status: false
Title: Java Software Solutions
Author: John Lewis and William Loftus
Publisher: Addison Wesley
Copyright date: 2005
ISBN number: 0-321-32203-7
Checked out status: false
Title: Computer Science: An Overview, 9th edition
Author: J. Glenn Brookshear
Publisher: Addison Wesley
Copyright date: 2005
ISBN number: 0-321-24726-4
Checked out status: false
Title: Programming Languages: Principles and Paradigms, 2nd edition
Author: Allen Tucker and Robert Noonan
Publisher: McGraw-Hill
Copyright date: 2007
ISBN number: 0-07-238111-6
Checked out status: true
Java Software Solutions, 2005
Programming Languages: Principles and Paradigms, 2nd edition, Allen Tucker and Robert Noonan, 2007
Testing
Continually test your program until your output looks exactly like the above.
Specifications for Documentation and Format
Normally you will be expected to determine what documentation and
formatting will be necessary for your project on your own, with the help
of the Style Guide in your Lab manual. Fully correct documentation for
both
files must
follow the javadoc conventions and include:
- A class prologue at the top of your program files. The @author tag must
contain your name, your e-mail address, your
W&M phone extension.
The prologue
must also contain a full description of the project.
- In addition each method should have a prologue written in javadoc which
includes a description of the method, the @param tags if appropriate and the @return tags if appropriate.
- Each closing brace must be commented (and there will be many of them), eg:
} // main
- Correct formatting requires that the code must be reasonably and
consistently indented.
- Horizontal and vertical white
space must be used reasonably and consistently.
Submission
Submit your program file electronically:
In Eclipse, right click on the project and import the files from
/home/f85/debbie/cs141/Proj2.
Right click on the file submit.xml and select Run -> 1 Ant Build;
Messages will appear in the Console window. Be sure to determine
whether you got the Build successful message to ensure that your
electronic file submission for this lab was successful.
Honor Code. The honor code applies to all programming done in
this course. Reread the CS Department's document: Programming
Assignments and the Honor Code.
Start now .. your mileage may vary
Debbie Noonan, debbie@cs.wm.edu
Feb. 13, 2007