12345678 |
- // returns true if prob * prize > pay; otherwise return false.
- // To illustrate, profitableGamble(0.2, 50, 9) should yield true,
- // since the net profit is 1 (0.2 * 50 - 9), and 1 > 0.
- function profitableGamble(prob, prize, pay) {
- if ((prob * prize) > pay){return true;}
- else {return false;}
- }
|