<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC 
    "-//Dawid Weiss//DTD DocBook V3.1-Based Extension for XML and graphics inclusion//EN" 
    "http://www.cs.put.poznan.pl/dweiss/dtd/dweiss-docbook-extensions.dtd" [
<!ENTITY % isopub SYSTEM "iso-pub.ent"> 
%isopub;
<!ENTITY % local SYSTEM "local-entities.ent">
%local; 
]>

<article id="project4">

	<articleinfo>
		<title>Project 4</title>
		<author>
			<firstname>Kevin</firstname>
			<surname>Nilson</surname>

			<affiliation>
				<orgname>http://www.smccd.net/accounts/nilsonk/</orgname>
			</affiliation>
		</author>

		<abstract>
			<simpara>CS 381 Project 4, Java Programming I, Fall 06</simpara>
		</abstract>

	</articleinfo>

	<sect1 id="assignment">
		<title>Assignment</title>
		<simpara>Due - September 27</simpara>
		<simpara>Write a simple Java program that performs like a more advanced cash register.</simpara>

		<itemizedlist>
			<listitem>
				<para>Your Java Classes should use the package edu.smccd.cis381.fall2006.project4</para>
			</listitem>
			<listitem>
				<para>Your program must be compatible with project4-build.xml</para>
			</listitem>
		</itemizedlist>

		<itemizedlist>
			<title>I expect 5 classes for this assignment</title>
			<listitem>
				<para>CashRegister</para>
			</listitem>
			<listitem>
				<para>Money</para>
			</listitem>
			<listitem>
				<para>StoreItem</para>
			</listitem>
			<listitem>
				<para>Receipt</para>
			</listitem>
			<listitem>
				<para>CashRegisterTester</para>
			</listitem>
		</itemizedlist>

		<simpara>Please review "How to Turn in Assignments" for information about how to submit and other requirements.</simpara>
	</sect1>


	<sect1 id="uml">
		<title>Description of Classes</title>
		<figure>
			<title>UML</title>
			<mediaobject>
				<imageobject>
					<imagedata fileref="figures/project04/project4ClassDiagram.png" format="PNG" />
				</imageobject>
				<caption>
					<para>Class Diagram for Project 4</para>
				</caption>
			</mediaobject>
		</figure>

	</sect1>

	<sect1 id="tester">
		<title>CashRegisterTester</title>
		<orderedlist numeration="arabic">
			<title>CashRegisterTester should do the following</title>
			<listitem>
				<para>Create one or more CashRegisters.</para>
			</listitem>
			<listitem>
				<para>Add some items.</para>
			</listitem>
			<listitem>
				<para>Print the amount due to the customer.</para>
			</listitem>
			<listitem>
				<para>Checkout, which prints a receipt.</para>
			</listitem>
			<listitem>
				<para>Print change given.</para>
			</listitem>
			<listitem>
				<para>Print the balance of the cash register before exiting.</para>
			</listitem>
		</orderedlist>

		<programlisting>
CashRegister cashRegister=new CashRegister();
		
StoreItem item = new StoreItem();
item.setCost(1);
item.setQuantity(10);
item.setDescription("milk");
cashRegister.addItem(item);

item = new StoreItem();
item.setCost(2.20);
item.setQuantity(5);
item.setDescription("bread");
cashRegister.addItem(item);

item = new StoreItem();
item.setCost(10.23);
item.setQuantity(10);
item.setDescription("Jiffy Peanut Butter");
cashRegister.addItem(item);

cashRegister.printoutDue();


Money money = new Money();
money.setNumTwenties(10);

Money change = cashRegister.checkout(money);
System.out.println();
System.out.println("Change given is:");
System.out.println(change);
        </programlisting>
	</sect1>


	<sect1 id="cashregister">
		<title>CashRegister</title>
		<itemizedlist>
			<listitem>
				<para>return null Change if not sufficient funds given to make purchase</para>
			</listitem>
			<listitem>
				<para>May make change at any time.</para>
			</listitem>
			<listitem>
				<para>No refunds are given, only purchases may be made.</para>
			</listitem>
			<listitem>
				<para>The register only keeps track of the total balance, it does not have any idea what bills and coins it has inside.</para>
			</listitem>
			<listitem>
				<para>Checkout should print the receipt to the console.</para>
			</listitem>
		</itemizedlist>
	</sect1>

	<sect1 id="money">
		<title>Money</title>
		<itemizedlist>
			<listitem>
				<para>Don't forget 5 singles is equal to a five dollar bill.</para>
			</listitem>
			<listitem>
				<para>When giving change please use as much of the highest value currency as possible.  When giving change $27.33 give: 1 twenty, 1 five, 2 singles, 1 quarter, 1 nickle, and 3 pennies.</para>
			</listitem>
			<listitem>
				<para>When customers pay they may use any distribution of currency they wish.</para>
			</listitem>
		</itemizedlist>
	</sect1>

	<sect1 id="receipt">
		<title>Receipt</title>
		<itemizedlist>
			<listitem>
				<para>Format the receipt last.  The format of the receipt String will be graded, but with little weight.  Get everything else working first.</para>
			</listitem>
			<listitem>
				<para>Try to make your receipt look like mine.  You may use a different format if it looks better than mine.</para>
			</listitem>
		</itemizedlist>

		<programlisting>
Item Cost = $123.30
Tax = $8.63
Total Due = $131.93

 ---------------------- 
| 10 milk        $10.00|
|  5 bread       $11.00|
| 10 Jiffy Pean $102.30|
|----------------------|
| Item Cost:           |
| $123.30              |
|----------------------|
| Tax:                 |
| $8.63                |
|----------------------|
| Amount Due:          |
| $131.93              |
|----------------------|
| Amount Given:        |
| $200.00              |
|----------------------|
| Change:              |
| $68.07               |
 ---------------------- 


Change given is:
pennies=2 nickels=1 dimes=0 quarters=0 singles=3 fives=1 tens=0 twenties=3 amount=68.07
       	
       	</programlisting>
	</sect1>


	<sect1 id="storeitem">
		<title>StoreItem</title>
		<itemizedlist>
			<listitem>
				<para>Items the customer wants to purchase.</para>
			</listitem>
			<listitem>
				<para>You may want to add a toString method.</para>
			</listitem>
		</itemizedlist>
	</sect1>


</article>