home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs
lect09b
A Design Exercise
Amazin' Orders
At Amazin'.com,
you can order books and other goods.
When you check out, an order is created.
Think of how the web page has you type in these various pieces of info:
-
your name (including first and last name and title,
so they can send appropriate email, greet you by first name,
including only first-initial on the mailing label, etc..)
-
The total price
-
The shipping address
-
The credit-card information
-
The billing address
- a phone-number (including area code, exchange, and extension;
sometimes they want to use only certain parts of the entire phone number)
-
the order-date
-
the expected date the order will ship from the warehouse
-
the expected delivery-date
For each of these pieces of information,
-
how many entry-boxes are there, on the web form?
-
Does each text-entry box correspond to sub-pieces of information?
Might we ever want to keep track of a sub-piece separately?
-
What types/classes should we use to keep track of an order at Amazin'.com?
-
Do you think Amazin'.com has a getter for this field?
A setter? Is it public, or private?
-
When are two objects considered logically equal?
That is, should you write a equals method
that does more than ==?
Draw a picture of an OrderInfo object,
based on your brainstorming.
We have already seen a class Date.
What would
class Address look like?
(Define its fields, and sketch the constructor and
write one getter.)
task: Write canCombine.
Two orders can be combined if they
have the same receipient (up to title),
and the same destination address,
and the order-placed date is before the ship-date of another.
How should we tell when two OrderInfos
are the exact same order?
Here is
part of
one possible solution.
home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs