NatanZB

Untitled

Jun 19th, 2015
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. static bool InvesmentBrokerExample() {
  2.  
  3. InvestmentBroker broker;
  4. broker.addShare("RAF", 112, 5001);
  5. broker.addShare("NAT", 224, 4001);
  6. broker.addShare("VAL", 336, 3001);
  7. //broker.addBond("THIS", 448, 5432);
  8. //broker.addBond("TEST", 550, 4211);
  9. //broker.addBond("ROCK", 662, 4877);
  10. const string customer1 = "111111111";
  11. const string customer2 = "111111112";
  12. //const string customer3 = "111111113";
  13. //const string customer4 = "111111114";
  14. broker.addCustomer(customer1, 10000, HIGH_RISK);
  15. broker.addCustomer(customer2, 10000, HIGH_RISK);
  16. //broker.addCustomer(customer3, 10000, HIGH_RISK);
  17. //broker.addCustomer(customer4, 30000, HIGH_RISK);
  18. broker.nextTradeDay(); //new customers!
  19. broker.nextTradeDay(); //new customers!
  20. broker.printFullReport();
  21. broker.printCustomerReport(customer1);
  22. broker.printCustomerReport(customer2);
  23. //broker.printCustomerReport(customer3);
  24. //broker.printCustomerReport(customer4);
  25. //create risks
  26. for (int i = 0; i < 2; ++i) {
  27. if (i % 7) {
  28. if (i % 2) {
  29. broker.changePreference(customer1, HIGH_RISK, i - 1);
  30. } else {
  31. broker.changePreference(customer1, LOW_RISK, i + 1);
  32. }
  33. }
  34. if (i % 8) {
  35. if (i % 3) {
  36. broker.changePreference(customer2, HIGH_RISK, i + 2);
  37. } else {
  38. broker.changePreference(customer2, LOW_RISK, i - 1);
  39. }
  40. }
  41. /*if (!i % 5) {
  42. broker.changePreference(customer3, HIGH_RISK, i);
  43. }
  44. if (!i % 20) {
  45. if (i % 3) {
  46. broker.changePreference(customer4, HIGH_RISK, i + 3);
  47. } else {
  48. broker.changePreference(customer4, LOW_RISK, i + 3);
  49. }
  50. }*/
  51. broker.nextTradeDay();
  52. cout << "Day " << i << endl;
  53. broker.printFullReport();
  54. broker.printCustomerReport(customer1);
  55. broker.printCustomerReport(customer2);
  56. //broker.printCustomerReport(customer3);
  57. //broker.printCustomerReport(customer4);
  58. }
  59. broker.printFullReport();
  60. return true;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment