Difference between revisions of "2020 - Display net gain/loss for the companies"
(Created page with "=The Issue= The balance for each company is displayed every turn, it prints the previous and the current balance. Profit / Loss is the difference between the two. =Solution=...") |
(No difference)
|
Latest revision as of 09:24, 11 December 2019
The Issue
The balance for each company is displayed every turn, it prints the previous and the current balance. Profit / Loss is the difference between the two.
Solution
Add an output to display the Profit / Loss for the company
Example
Find the 'ProcessDayEnd' method in the Company class, look for the final lines in this method:
details += "Previous balance for company: " + balance.ToString() + "\n";
balance += profitLossFromOutlets - dailyCosts - deliveryCosts;
details += "New balance for company: " + balance.ToString();
return details;
We need to add more to 'details', so add the following line before the 'return details;' line:
details += "Profit / Loss for company: " + (profitLossFromOutlets - dailyCosts - deliveryCosts);