about | help | code help+videos | done | prefs |
For this problem you must limit the number of conditionals you use. You are not allowed to use more than 6 conditional statements including "if" and the tertiary conditional "?". Write a method that returns the score you earn during a turn of a game. In this game, you flip four coins simultaneously. For each coin that comes up "heads" (represented by a boolean parameter being 'true') your score goes up. If all coins are tails (all booleans are 'false') you earn 0 points. If any ONE coin is heads you earn 1 point. If any TWO coins are heads you earn 10 points. If any THREE coins are heads you earn 100 points. If ALL of the coins are heads you earn 1000 points. Remember, you may use AT MOST 6 conditional statements! jan8_2016_SLHLgameScore(true, true, true, false) → 100 jan8_2016_SLHLgameScore(true, false, false, false) → 1 jan8_2016_SLHLgameScore(false, true, false, false) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy