Ask Question
1 March, 01:37

A statistician would like to simulate rolling a single die until she has rolled the die a total of 100 times, or she rolls a six a total of 25 times, whichever comes first. Which boolean expression should she use for the to accomplish this? var rolls = 0; var sixes = 0; while () {var nextRoll = randomNumber (1, 6); if (nextRoll = = 6) {sixes = sixes + 1; }rolls = rolls + 1; }console. log (rolls); console. log (sixes); rolls > = 0 && sixes < 25rolls < 100 && sixes < 25rolls < 100 || sixes < 25rolls = 100 || sixes < = 25rolls

+3
Answers (1)
  1. 1 March, 02:31
    0
    The missing code is rolls < 100 && sixes < 25

    Explanation:

    From the question, the while loop is expected to terminate (stop rolling) with either rolls reaches 100 or sixes reaches 25. This means we expect if one of the two conditions

    rolls < 100 sixes < 25

    is not met, the while loop should stop and print the rolls and sixes.

    To achieve the aim, we use logical operator AND, &&, to join the two conditions in the while loop.

    With AND logical operator, if rolls reaches 100, the condition rolls < 100 will return false.

    So false && true - > false (While loop stop)

    If sixes reaches 25, the condition sixes < 25 will return false.

    So true && false - > false (While loop stop).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A statistician would like to simulate rolling a single die until she has rolled the die a total of 100 times, or she rolls a six a total of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers