Remembering Java

Due 8/23

To help us remember Java, we'll do a little warmup homework. This was a practicum for the 2012 12-week IC211 exam. This should not be hard, but it might take some time to remember everything. There shouldn't be a lot of reason for this to be less than perfect.

Submit it as detailed on the course Resources page as "warmup."

You are going to implement some useful code for a bookstore, which they can use to keep track of inventory. A full submission for this practicum will contain 6 classes (ReadingMaterial, Book, Magazine, Bookstore, OutOfStockException, BookMain). Note BookMain is written for you.

Download warmup.tgz for test files and BookMain.java.

Unpack it with tar xzf warmup.tgz

ReadingMaterial

ReadingMaterial implements Comparable. Each reading material object has:

Book

Book extends ReadingMaterial. In addition to what it inherits from ReadingMaterial, it has:

Magazine

Magazine extends ReadingMaterial. In addition to what it inherits from ReadingMaterial, it has:

Bookstore

Bookstore contains all the ReadingMaterials we are hoping to sell. So, it has:

OutOfStockException

behaves like a RuntimeException.

BookMain

is entirely written.

You have downloaded and unpacked a directory with BookMain.java and two test files, testFile.txt, and input.txt. If your code is run as follows, it should result in the following output:

taylor@albert:~/12wk/practicum$ java BookMain testFile.txt < input.txt 
The Economist: $0.99
Sports Illustrated: $1.5
David Foster Wallace, Infinite Jest: $15.99
Harry S Truman, Mr. Citizen: $21.99

What would you like to buy?
You are trying to buy Infinite Jest
What would you like to buy?
You are trying to buy Mr. Citizen
What would you like to buy?
You are trying to buy Mr. Citizen
Out of stock!
What would you like to buy?
You are trying to buy The Economist
Out of stock!
What would you like to buy?
You are trying to buy Nonexistant
Out of stock!
What would you like to buy?













About this document ...

Remembering Java

This document was generated using the LaTeX2HTML translator Version 2008 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -no-navigation warmupHW.tex

The translation was initiated by Gavin Taylor on 2013-08-16


Gavin Taylor 2013-08-16