// pre-populate the domain objects before GUI comes up public class StockInit { public StockInit() { // called by StockApplet //create investors Investor i1 = new Investor ("jones","jones","John","Jones","510-111-1111"); Investor i2 = new Investor ("smith","smith","John","Smith","510-222-2222"); Investor i3 = new Investor ("adams","adams","John","Adams","510-333-3333"); // create acccounts for the investors above Account a1 = new Account(i1, 1000.0); Account a2 = new Account(i2, 1000.0); Account a3 = new Account(i3, 1000.0); // cash is used as the "stock" transaction for DEPOSIT/WITHDRAW Stock cash = new Stock("CASH",0.00); // create stocks with market price Stock s1 = new Stock("IBM",84.00); Stock s2 = new Stock("CSCO",22.00); Stock s3 = new Stock("INTC",20.00); // give some holdings to the accounts // concatenated primary key is really references to parents new Holding(a1,s1,10); new Holding(a1,s2,100); new Holding(a2,s3,100); new Holding(a3,s2,100); // generate some existing transactions new Transaction(a1,cash,"DEPOSIT",1000.00,1); new Transaction(a2,cash,"DEPOSIT",1000.00,1); new Transaction(a3,cash,"DEPOSIT",1000.00,1); new Transaction(a1,s1,"BUY",80.00,5); new Transaction(a1,s1,"SOLD",82.00,5); new Transaction(a1,s2,"BUY",20.00,100); new Transaction(a2,s3,"BUY",18.00,100); new Transaction(a3,s2,"BUY",19.00,100); // generate some outstanding pending orders new Order(a1,s3,"BUY",19.00,50); new Order(a2,s3,"SELL",23.00,50); new Order(a3,s3,"SELL",21.00,75); new Order(a3,s1,"BUY",82.00,5); new Order(a3,s1,"BUY",82.50,5); new Order(a1,s1,"SELL",86.00,5); } }