Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool InvesmentBrokerExample() {
- InvestmentBroker broker;
- broker.addBond("RAF", 112, 5001);
- broker.addBond("NAT", 224, 4001);
- broker.addBond("VAL", 336, 3001);
- broker.addBond("THIS", 448, 5432);
- broker.addBond("TEST", 550, 4211);
- broker.addBond("ROCK", 662, 4877);
- const string customer1 = "111111111";
- const string customer2 = "111111112";
- const string customer3 = "111111113";
- const string customer4 = "111111114";
- broker.addCustomer(customer1, 10000, HIGH_RISK);
- broker.addCustomer(customer2, 10000, HIGH_RISK);
- broker.addCustomer(customer3, 10000, HIGH_RISK);
- broker.addCustomer(customer4, 30000, HIGH_RISK);
- broker.nextTradeDay(); //new customers!
- broker.nextTradeDay(); //new customers!
- broker.printFullReport();
- broker.printCustomerReport(customer1);
- broker.printCustomerReport(customer2);
- broker.printCustomerReport(customer3);
- broker.printCustomerReport(customer4);
- //create risks
- for (int i = 0; i < 600; ++i) {
- if (i % 7) {
- if (i % 2) {
- broker.changePreference(customer1, HIGH_RISK, i - 1);
- } else {
- broker.changePreference(customer1, LOW_RISK, i + 1);
- }
- }
- if (i % 8) {
- if (i % 3) {
- broker.changePreference(customer2, HIGH_RISK, i + 2);
- } else {
- broker.changePreference(customer2, LOW_RISK, i - 1);
- }
- }
- if (!i % 5) {
- broker.changePreference(customer3, HIGH_RISK, i);
- }
- if (!i % 20) {
- if (i % 3) {
- broker.changePreference(customer4, HIGH_RISK, i + 3);
- } else {
- broker.changePreference(customer4, LOW_RISK, i + 3);
- }
- }
- broker.nextTradeDay();
- cout << "Day " << i << endl;
- broker.printFullReport();
- broker.printCustomerReport(customer1);
- broker.printCustomerReport(customer2);
- broker.printCustomerReport(customer3);
- }
- broker.printFullReport();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment