NatanZB

Untitled

Jun 19th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. static bool InvesmentBrokerExample() {
  2.  
  3. InvestmentBroker broker;
  4. broker.addBond("AAPL", 112, 5001);
  5. broker.addBond("INTC", 224, 4001);
  6. broker.addBond("YHOO", 336, 3001);
  7. const string customer1 = "111111111";
  8. const string customer2 = "111111112";
  9. //const string customer3 = "111111113";
  10. broker.addCustomer(customer1, 10000, HIGH_RISK);
  11. broker.addCustomer(customer2, 10000, HIGH_RISK);
  12. //broker.addCustomer(customer3, 10000, HIGH_RISK);
  13. broker.nextTradeDay(); //new customers!
  14. broker.nextTradeDay(); //new customers!
  15. broker.printFullReport();
  16. broker.printCustomerReport(customer1);
  17. broker.printCustomerReport(customer2);
  18. //broker.printCustomerReport(customer3);
  19. //create risks
  20. for (int i = 0; i < 44; ++i) {
  21. if (i % 2) {
  22. broker.changePreference(customer1, HIGH_RISK, i + 1);
  23. } else {
  24. broker.changePreference(customer1, LOW_RISK, i + 1);
  25. }
  26. if (i % 3) {
  27. broker.changePreference(customer2, HIGH_RISK, i);
  28. } else {
  29. broker.changePreference(customer2, LOW_RISK, i);
  30. }
  31. /*if (!i%5){
  32. broker.changePreference(customer3, HIGH_RISK, i);
  33. }*/
  34. broker.nextTradeDay();
  35. cout << "Day" << i << endl;
  36. broker.printFullReport();
  37. broker.printCustomerReport(customer1);
  38. broker.printCustomerReport(customer2);
  39. //broker.printCustomerReport(customer3);
  40. }
  41. broker.printFullReport();
  42. return true;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment