int getUpperScore(){      int upperScore = 0;      for(int i = ONES; i <= SIXES; i++){        upperScore += score[i];      }      return upperScore + getBonusScore();    }     //Returns the score of the upper part of the board    int getLowerScore(){      int lowerScore = 0;      for(int i = THREE_OF_KIND; i <= YAHTZEE; i++){        lowerScore += score[i];      }      return lowerScore;    }     //Returns the bonus points    int getBonusScore(){      const int UPPER_SCORES_THRESHOLD = 63;      const int BONUS_POINTS = 35;      if(getUpperScore() >= UPPER_SCORES_THRESHOLD){        return BONUS_POINTS;      }      return 0;    }     //Returns the total score    int getTotalScore(){      return getUpperScore() + getLowerScore();    } Test 10: Check upper board and having bonus correctly (0/3) failed

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

int getUpperScore(){
      int upperScore = 0;
      for(int i = ONES; i <= SIXES; i++){
        upperScore += score[i];
      }
      return upperScore + getBonusScore();
    }

    //Returns the score of the upper part of the board
    int getLowerScore(){
      int lowerScore = 0;
      for(int i = THREE_OF_KIND; i <= YAHTZEE; i++){
        lowerScore += score[i];
      }
      return lowerScore;
    }


    //Returns the bonus points
    int getBonusScore(){
      const int UPPER_SCORES_THRESHOLD = 63;
      const int BONUS_POINTS = 35;
      if(getUpperScore() >= UPPER_SCORES_THRESHOLD){
        return BONUS_POINTS;
      }
      return 0;
    }

    //Returns the total score
    int getTotalScore(){
      return getUpperScore() + getLowerScore();
    }

Test 10: Check upper board and having bonus correctly (0/3)
failed
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT