Advertisement
amarek

OOP

Nov 18th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. double getProfit(SolarPanel panel, double price) {
  2.     double profit = panel.kWh();
  3.     return profit * price;
  4. }
  5.  
  6. double getProfit(SolarPanel* panels, int n, double price) {
  7.     double profit = 0;
  8.     for (int i = 0; i < n; i++) {
  9.         profit += panels[i].kWh();
  10.     }
  11.  
  12.     return profit * price;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement