CEMC Banner

Problem of the Week
Problem B and Solution
Book Club

Problem

In Emil’s book club, each of the \(10\) members rates each book they read on a scale from \(1\) to \(5\). Emil wants to write a program to calculate the average rating for a book.

  1. Complete the given flowchart to show the steps Emil’s program needs to follow to calculate the average (mean) rating for a book.

    A flowchart with four steps in order from top to bottom. The
first step is to Input 10 ratings. The second and third steps are blank.
The fourth and final step is to Output the average rating.

  2. Emil finds that sometimes people make mistakes when typing their ratings. Modify your flowchart so that if a rating is not between \(1\) and \(5\), users have to input the \(10\) ratings again.

  3. Modify your flowchart from part (b) so that if the average rating is over \(4\), a message is displayed that says the book is excellent.

  4. What is the lowest possible rating that one of the book club members could give a book that could still result in a message saying the book is excellent?

Solution

  1. In order to calculate the average rating, we first need to add the \(10\) ratings together, and then divide this value by \(10\). These steps are shown in the flowchart.

    A flowchart with four steps: 1. Input 10
ratings; 2. Find the sum of the 10 ratings; 3. Divide this sum by 10; 4.
Output the average rating.

  2. The program should check for errors right after the \(10\) ratings are inputted. If the ratings are not all between \(1\) and \(5\), then the program should return to the beginning so the user can input the \(10\) ratings again. This is shown in the flowchart.

    A description of the flowchart follows.

  3. The program needs check if the average rating is greater than \(4\) sometime after it has been calculated. In the flowchart shown, we first check if the average rating is greater than \(4\) and then output the average rating. However it is also possible to switch the order of these two steps.

    A description of the flowchart follows.

  4. If a message says the book is excellent, then it must have an average rating greater than \(4\). This means the sum of the \(10\) ratings must be greater than \(4 \times 10 = 40\). Suppose \(9\) of the members gave a rating of \(5\). Then the sum of their ratings would be \(9 \times 5 = 45\). So the remaining member could give a rating as low as \(1\) and the sum of all \(10\) ratings would still be greater than \(40\). Therefore, the lowest possible rating is \(1\).