View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Spring 2003 M2: Handle multiple users and portfolios, Create basic GUI

Milestone 2 (Individual)



Modify your design to account for the fact that your application may have several users, each of whom may have several portfolios each of which may have an arbitrary number of accounts of different types. An account might be in more than one portfolio. In addition to being able to perform all the individual transactions of M1, each account should keep a timestamped history of both successful and unsuccessful transactions.
Accounts should be able to generate one of three types of printed reports:
For historical tracking purposes, any interest rate or share price change should also be recorded in the history. Users want to be able to find accounts by their type (show me all the stocks), or by number (show me all my COKE stock). Provide a simple GUI to display a user's account status. The specification of this GUI is detailed below. Code SUnit tests for classes created since M1.

An example transaction report would contain information like the following:

Exception Transaction Report for:

First Union # 123-79A  as of: 01/14/03 1430.

1000 01/01/03  Invalid deposit amount, -1 dollars.  Ignored.

1430 01/03/03  Attempted Overdraft.  Requested 623.50, Balance 530.45. Ignored.


Normal Transaction Report for:

First Union #123-79A as of: 01/14/03 1500.

0001 01/01/03 Interest Rate changed to 5.25.

0945 01/03/03 Deposit 345.75.

1900 01/05/03 Withdrawal 12.76


(Your actual entries and error messages may vary, but a timestamp, error description and system action are required for each entry.

Here are the minimal external messages for the core objects.  You may need more messages and more classes to do the full the implementation (note we are leaving much more of the design open to you):

User Portfolio Account (new M2 methods)

name: name  "Set user name"

name "return user name"

name: name "set portfolio name"

name "return portfolio name"

transactions "return a collection of all transactions on this account"

password: newPassword "Set password"

password "return password"

account: account "add an account"

accounts "return a collection of accounts in this portfolio (by number)"


portfolio: portfolio "add a new portfolio"

portfolios "return a collection of all portfolios"

findAccount: accountNumber "return the account object in this portfolio with this unique number"


findPortfolio: name "return the porfolio object which has this name"

find: accountNumber "Return the account object with this unique number"

findType: symbol "return a collection of account objects of this type. symbols should be #savings, #stock or #bond."

buy: portfolio: amount:  accountNumber portfolio amount "purchases the desired amount of shares or bonds; or deposits the desired amount in the identified portfolio and account"    
netWorth  "Should return the current netWorth (sum of all the values of the accounts in all portfolios)"    
showExceptionReport: portfolio: aString1 aString2 "Print an report of all the exception transactions made to the account in aString1 in portfolio aString2"

showNormalReport: portfolio: aString aString "Print only successful transactions"

showFullReport: portfolio: aString aString "Print all (normal and exception) transactions"

showStatus "Pop up the GUI user status report"    

Some typical operations would be:
u:=User new.
u name: Bob;
  password: foo. "Create a new user"
p1:= Portfolio new.
p1 name: 'Home'. "Create a portfolio for a user"
p2:=Portfolio new.
p2 name: 'Work'.
u portfolio: p1. "Assign a portfolio to a user"
u portfolio: p2.
s:=FixedSavings new.
s name: 'First Union';
  number: '123-79A';
  balance: 3245.56;
  rate 5.25.
r:=EquityStock new.
r name: 'Merrill Lynch';
  number: 'COKE';
  balance: 5 ;
  price: 135.25.
b:=EquityBond new.
b name: 'Fidelity Municipal Bond';
  number: 'MUNI32';
  balance: 32;
  rate: 3.45;
  faceValue: 1000.
p1 account: s. "Assign an account to a portfolio"
p1 account: r.  "assign stock r to portfolio p1"
p2 account: r. "assign stock r to portfolio p2"
p1 account: b. "Assign bond b to portfolio p1"
p1 accounts. "should return collection (123-79A COKE MUNI32) of accounts"
u portfolios.  "should return collection ( Home Work) of portfolios"
u find: 'COKE'. "should return the COKE account object"
u find: 'CTFX'. "should return nil because no such account"
u findType: #stock. "should return all accounts for a user that are stock accounts.  May also accept #bond or #savings"
(Note that the next operation should create an success entry in the history of the COKE account)
u buy: 'COKE' portfolio: 'Home' amount: 1352.50.  "should buy 10 shares of COKE account in Home portfolio"
u showExceptionReport: 'COKE' portfolio: 'Home'. "should print the exception report to the Transcript"
u netWorth.  "should return value of all portfolios in dollars, do not double count accounts!"

GUI Requirements:

Your GUI may use Morphic or simple "Joe-the-Box" style I/O mechanisms. Your GUI should at a minimum allow display of user status.
Information to be displayed should be:
For each portfolio, the name and a list of accounts and account information should be displayed. Account information includes the name, number, current value. If the account is in more that one portfolio it should be marked somehow to show this. There should be a mechanism to choose sorting the display by name ascending or descending order. Sorting should be done in two stages: Portfolio and account. Thus if Portfolio Home has account A,B,C and Portfolio Work has D,E,F then Ascending would print:
and Descending would print:
All other information not specified in this display may be printed to the Transcript.

In class, please turn-in:

Before class time, turn-in your code using the Spring 2003 Turnin Information with the code 'M2'.


Questions on Spring 2003 M2 Milestone

Links to this Page