<?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="homework01">

	<articleinfo>
		<title>Project 2 - Single Student Grade Calculator</title>
		<author>
			<firstname>Kevin</firstname>
			<surname>Nilson</surname>

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

		<abstract>
			<simpara>CS 382 Project 2, Java Programming I, Fall 06</simpara>
		</abstract>

	</articleinfo>

	<sect1 id="assignment">
		<title>Assignment</title>
		<simpara>Due - Due November 3</simpara>
		<simpara>Write a Java Program to calculate grades for a single student.</simpara>

		<itemizedlist>
			<listitem>
				<para>Your Java Classes should use the packages edu.smccd.cis382.fall2006.project2, edu.smccd.cis382.fall2006.project2.grabber, and edu.smccd.cis382.fall2006.project2.exception.</para>
			</listitem>
			<listitem>
				<para>Your program must be compatible with project2-build.xml.  Do not include your UnitTests in the base directory when running the unit test.  I do not want to require configuring location of junit.jar when running the build script.</para>
			</listitem>
		</itemizedlist>

		<itemizedlist>
			<title>I expect the following classes for this assignment</title>
			<listitem>
				<para>GradeCalculator</para>
			</listitem>
			<listitem>
				<para>PointsGradeCalculator</para>
			</listitem>
			<listitem>
				<para>WeightGradeCalculator</para>
			</listitem>
			<listitem>
				<para>Grade</para>
			</listitem>
			<listitem>
				<para>PointsGrabber</para>
			</listitem>
			<listitem>
				<para>PointsGrabberImpl</para>
			</listitem>
			<listitem>
				<para>PointsGrabberMoc</para>
			</listitem>
			<listitem>
				<para>WeightPointsGrabber</para>
			</listitem>
			<listitem>
				<para>WeightPointsGrabberImpl</para>
			</listitem>
			<listitem>
				<para>WeightPointsGrabberMoc</para>
			</listitem>
			<listitem>
				<para>GradebookException</para>
			</listitem>
			<listitem>
				<para>GradeCalculatorTester</para>
			</listitem>
			<listitem>
				<para>GradeCalculatorTesterMocs</para>
			</listitem>
			<listitem>
				<para>GradeCalculatorUnitTest</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/project02/project2ClassDiagram.png" format="PNG" />
				</imageobject>
				<caption>
					<para>Class Diagram for Project 2</para>
				</caption>
			</mediaobject>
		</figure>

	</sect1>

	<sect1 id="GradeCalculator">
		<title>GradeCalculator</title>
		<orderedlist numeration="arabic">
			<listitem>
				<para>GradeCalculator is an abstract class with abstract methods retrieveGrades and calculatePercent.</para>
			</listitem>
			<listitem>
				<para>Letter Grades are calculated as  90 &gt;= A, 80 &gt;= B, 70 &gt;= C, 60 &gt;= D, 60 &lt; F, .</para>
			</listitem>
			<listitem>
				<para>PointsGradeCalculator calculates grades by dividing the possible points by the points earned to calculate the percent</para>
			</listitem>
			<listitem>
				<para>WeightGradeCalculator calculates grades like we do in CIS 382.  Diffent sections are given weights.  For example in CIS 382 the assignments for the final exam are give a weight of 40 and all other assignments are given a weight of 60.  If there are no possible points for some of the sections you just ignore that section when calculating the grade.  For example currently you have 100 percent in CIS 381 but you have 0 points possible for the final.</para>
			</listitem>
			<listitem>
				<para>When the WeightPointsGrabber retrieves the grades for a section the section is one based not zero based.  For example in CIS 382 section 1 would be the assignments and section 2 would be the final.</para>
			</listitem>
			<listitem>
				<para>GradebookException is thrown when no possible points are avaliable.</para>
			</listitem>
		</orderedlist>
	</sect1>


	<sect1 id="Grabbers">
		<title>Grabbers</title>
		<orderedlist numeration="arabic">
			<listitem>
				<para>Must contain Grabber in the file name.</para>
			</listitem>
			<listitem>
				<para>Used to retrieve grades.  Several implementations of the interface may exist so that moc objects don't require users to type in values during testing.</para>
			</listitem>
			<listitem>
				<para>You may wish to use Scanner to implement.</para>
			</listitem>
			<listitem>
				<para>You should promt the user with a meaningful message before requiring them to type in values.</para>
			</listitem>
		</orderedlist>
	</sect1>


	<sect1 id="Testing">
		<title>Testing</title>
		<orderedlist numeration="arabic">
			<listitem>
				<para>GradeCalculatorTester is a standard tester that runs from a main method.  This should require the user to type in values for grades on the command line.</para>
			</listitem>
			<listitem>
				<para>GradeCalculatorTesterMocs is a standard tester that runs from a main method.  The user should not be type in any values when running your unit test.  You should use moc objects to perform testing.  You should use PointsGrabberMoc and WeightPointsGrabberMoc to retrieve grades.  These moc classes should not require any user input.</para>
			</listitem>
			<listitem>
				<para>GradeCalculatorUnitTest is a unit test that uses JUnit to test your program.  The user should not be type in any values when running your unit test.  You should use moc objects to perform testing.  You can create additional grabber classes for your testing.  I would prefer if these classes were inner classes in the same file as the unit test.</para>
			</listitem>
		</orderedlist>
	</sect1>



	<sect1 id="Tester">
		<title>GradeCalculatorTester</title>

		<simpara>Here is a simple example of what yor tester may look like:</simpara>

		<programlisting>
GradeCalculator[] gradeCalculators=new GradeCalculator[2];

gradeCalculators[0]=new PointsGradeCalculator(new PointsGrabberImpl());
gradeCalculators[1]=new WeightGradeCalculator(new WeightPointsGrabberImpl());

for (int i = 0; i &lt; gradeCalculators.length; i++) {
      
	gradeCalculators[i].retrieveGrades();
	
	double percent = gradeCalculators[i].calculatePercent();
	char grade = gradeCalculators[i].determineLetterGrade(percent);
	
	System.out.println(percent+" = "+grade);
}
		</programlisting>
	</sect1>


	<sect1 id="notes">
		<title>Notes</title>
		<itemizedlist>
			<listitem>
				<para>Due date may be extended.</para>
			</listitem>
			<listitem>
				<para>The public interface must remain exactly the same as the UML.  You may add any additional private methods you wish.</para>
			</listitem>
		</itemizedlist>
	</sect1>

	<sect1 id="updates">
		<title>Updates</title>
		<itemizedlist>
			<listitem>
				<para>Grade[][] grades added to WeightGradeCalculator.  Umbrello just ignored it when I generated the diagram.</para>
			</listitem>
			<listitem>
				<para>renamed GradeCalculator.determainLetterGrade to GradeCalculator.determineLetterGrade.</para>
			</listitem>
			<listitem>
				<para>Due date changed to November 1.</para>
			</listitem>
			<listitem>
				<para>Tester Code added.</para>
			</listitem>

		</itemizedlist>
	</sect1>

	<sect1 id="questions">
		<title>Questions</title>
			<para>Post questions to the forum or ask during lab and lecture.</para>
	</sect1>


</article>