Java Reference
In-Depth Information
Example 13.1 The bare bones of our Account class
package net.multitool.core;
import net.multitool.util.*;
import java.util.*;
/**
* The basic Account class for our budgeting example; this is the
* first-cut "implementation" where we have just transferred our
* design into Java code. We can use this much to generate Javadocs
* and also to begin our JUnit testing (design, test, code).
*/
public class
Account
{
private String name; // a name to identify this account
private User owner; // the user assigned to this account
private SAMoney total; // total amt allocated to this account
private HashMap children; // the collection of subaccounts,
// by name
private Account parent; // it has this account as a child
/**
* Create an account, with a pool of dollars to budget.
* Use this constructor to create the master account.
* Use "createSub" to create children of this account.
*/
public
Account(String name, User owner, String total)
{
}
/**
* Create a new subaccount (i.e., child), given a name
* and an amount. The child is connected to the parent.
*/
public Account
createSub(String name, String amt)
{
return null; // so it compiles
} // createChild
} // class Account
Search WWH ::




Custom Search