Java Reference
In-Depth Information
CHALLENGE 17.2
Complete the code for CheckFactoryCanada.java :
package com.oozinoz.check.canada;
import com.oozinoz.check.*;
public class CheckFactoryCanada extends CheckFactory
{
// ??
}
At this point, you have a solid design that applies the A BSTRACT F ACTORY pattern to provide
for the creation of families of objects that conduct checks of different kinds of customer
information. You have one family for U.S. checks and one for Canada checks. A final step is
to make your factories readily accessible.
CHALLENGE 17.3
Your system needs only one factory object for Canada checks and one for United
States checks. Write CheckFactory.java , including static variables that make it
easy for an application developer to access these factories:
package com.oozinoz.check;
import ??
import ??
public abstract class CheckFactory {
public static final CheckFactory US = ??
public static final CheckFactory ??
public abstract ?? createBillingCheck ??
public abstract ?? createCreditCheck ??
public abstract ?? createShippingCheck ??
}
Packages and Abstract Factories
Speaking loosely, a package is usually a "family" of classes, and an abstract factory produces
a "family" of objects. In the previous example, you used separate packages to support abstract
factories for Canada and the United States, with a third package that provides common
interfaces for the objects the factories produce.
Search WWH ::




Custom Search