Assignment
1 (10%): Due 11:59PM Friday October 7,
2011 |
This
assignment is intended to review more Java (multi-class object-oriented
programs, collections, etc.) and specifications and to start with some
testing. You will
write the real meat (or if you prefer, tofu) for a basic shopping
program for which we provide the GUI. The program displays a catalog
of items for sale (see image on the rights). The program allows a user
to purchase one or more items. Some items have a discount when you
buy enough of them. In addition, if the user selects the checkbox at
the bottom, the total will reflect a 10% discount if the cart contains
at least a (fixed) minimum total of items (20 in the image and for the
assignment). You will implement the following classes, which are specified below:
The specifications for these classes (except You need
to download the support files Run
|
It's important to
test your code incrementally as you are writing it. ShopTest
is
the class that will contain tests for your other classes. The GUI does not call
every method of every class nor does it call them with all parameter values or
in varied orders. You should test your code more aggressively than the GUI uses
it, test more varied behavior. (Remember: the implementation should not focus
on a particular client.) Use JUnit for your testing code. You can download and run a sample solution (you will likely
not get another sample solution during 331) to get a feel for the behavior.
(No, the source code is not included, only an executable of the sample
solution.) But the specifications are the one and only precise definition of
the assignment, so focus far more heavily on them.
Grading. 75% of your grade will be for program correctness. Correctness has two components: (a) does the GUI run properly (½ of correctness), and (b) is your implementation correct independent of the GUI (the other ½ of correctness). Note that this second part, especially, focuses on the quality of your test code. The remaining 25% is for documentation, code quality and style.
Documentation, code quality and style.
List
rather than
ArrayList
) for declarations of collections.toString
method if you find it useful in testing and
debugging your code.)35
).Source
menu in Eclipse has commands to help with this), good
naming, etc.Use
the @name
tag to identify yourself (identify the assignment, the
course, and your section) at the beginning of each class; make sure to include
a general descriptive comment for each class, as well as for other key and
complex sections of your code. You should focus carefully on using Javadoc
tags, including the common standard ones such as @param
,
@return
, and @throws
as well as the CSE331-specific
tags @requires
, @modifies
, and
@effects
.
Some Eclipse things you need to do
lib
.copy
both of these jar files. paste
command, paste both of them into the lib
folder.lib
. Right-click and select
Build Path >> Add to Build Path
. This should move them
from the lib
folder into a folder named Referenced
Libraries
, and this will let you use this code in your programs.common.xml
and build.xml
.common.xml
into Eclipse into the src
folder; it
should be at the same level as your Java packages.build.xml
into Eclipse into the package a1
that
you create to hold your code for Assignment 1.With just a little
bit of luck, you should now be able to open build.xml
, right-click
in that window, and select Run As... >> Ant Build ...
You
will then see a window that is a bit of a mess with a large number of
Ant
targets. For now, the only one of interest is doc
(which you'll need to scroll down to get most likely), which will now generate
Javadoc for your own code using the 331 additional tags. (OK, you will get an
error for one of them with the build -- I have to track down the code for
derivedfield
, which you don't need now anyway.) You can compile
and run your program directly, without Ant
.
Submit files to the course dropbox. Please do not archive files; upload them all individually to the dropbox.
You will need to turn in two kinds of files: