Slide 1
Slide 2
Managing Inventory
Data definition
Class diagram
Define classes an constructors (cont)
Define classes and constructors
Test Constructor
toString() method
Getter in classes Toy
Employee problem (again)
Data definition
Class diagram
Define classes an constructors (cont)
Define classes and constructors
toString() method
toString () in Employee
Test Constructor
Slide 19
Managing a Runner’s Logs Example
Data definition
Class diagram
Define classes an constructors (cont)
Define classes and constructors
toString() method
toString () in Entry
toString() in Date
Test Constructor
Recall restaurant example
Class diagram
Data definition
Define classes and constructors
Define classes and constructors (cont)
toString() method
toString() in Restaurant
toString () in Intersection
Test Constructor
Exercises
Prepare for next week
Slide 40
Recall Inventory problem
Class diagram
Add methods to the Class Diagram
Java template for Toy
Java template for Inventory
Java template for MTInventory
Java template for Cons
Slide 48
Q
howMany for Inventory
howMany() for MTInventory and Cons
Test howMany()
More requirement
contains for Inventory
Contains for MTInventory and Cons
Test contains()
More requirement
isBellow for Inventory
isBellow() for MTInventory and Cons
Test isBellow()
Slide 61
New requiremqnt
raisePrice for Inventory- Immutable version
raisePrice() for MTInventory and Cons
New version
Test raisePrice()
raisePrice - mutable version
raisePrice for Inventory- mutable version
raisePrice() for MTInventory and Cons
setPrice in Toy class
Test raisePrice()
Review “Overriding” and “Overloading”
Slide 73
Recall employee problem
Class diagram
Add methods Class Diagram
Java template for Employee
Java template for ALoEmployee
Java template for MTLoEmployee
Java template for ConsEmployee
Q
wages for ALoEmployee
Examples to test wages()
Define classes an constructors
Define classes an constructors (cont)
wages() in MTLoEmployee
wages() in ConsEmployee
wage() for Employee
Test wages()
Recall the problem of tracking a runner’s workouts
Class diagram for a runner’s log
Add methods to the runner’s log Class Diagram
Java template for Date
Java template for Entry
Java template for ALog
Java template for MTLog
Java template for ConsLog
Examples for a runner’s log
Q
miles() for ALog
Examples to test miles()
miles() in MTLog
miles() in ConsLog
getDistance() in Entry
Extension of the runner’s log problem
getLog() for ALog
Examples to test getLog()
getLog() for MTLog
getLog() for ConsLog
sameMonthInAYear() in Entry
sameMonthInAYear() in Date
ALog class diagram
Exercise 6.0.5
Exercise 6.0.6
Exercise 6.0.7
Exercise
Slide 117
Slide 118
Problem Statement
Sheme version
Modification of ALog
sortByDistance() in ALog
Examples
sortByDistance() in MTLog
sortByDistance() in ConsLog
Q
Modification of ALog
insertInDistanceOrder() in ALog
Examples for insertInDistanceOrder()
insertInDistanceOrder() in MTLog
insertInDistanceOrder() in ConsLog
hasDistanceShorterThan() in Entry
Exercise 6.0.8
Exercise (cont)
Slide 135
Overlaying shape example
Recall the current design
Design 1
Design 2
Design 3
Question
Define classes and constructors
Define classes and constructors
Define classes and constructors
Test constructor
Slide 146
Modified Class Diagram
distanceToO() in CompositeShape
Slide 149
Slide 150
Modified Class Diagram
contains() in CompositeShape
Slide 153
Bounding box for Composite shape
boundingBox() in CompositeShape
Slide 156
Slide 157
River Systems Example
Slide 159
Class Diagram (design 1)
Design 2
Design 3
Discussion
Define classes and constructors
Define classes and constructors (cont)
Test Constructor
Slide 167
Slide 168
Slide 169
Slide 170
Exercise 6.5.1
Exercise 6.5.1 Class Diagram
Exercise 6.5.2
Exercise 6.5.2 Class Diagram
Exercise 6.5.3
Slide 176