229k views
1 vote
Write an algorithm to output the average number of minutes the whole class spends playing computer games each day?

User Cenkisabi
by
8.1k points

1 Answer

5 votes

Final answer:

To calculate the class's daily average gaming time, sum the total hours spent on weekends, divide by the number of students and the number of weekend days, and then convert to minutes.

Step-by-step explanation:

To calculate the average number of minutes the whole class spends playing computer games each day, first sum up the total hours spent by the entire class on weekends. Then, to find the daily average, divide this total by the number of students and then by the number of days in the weekend (typically 2). Remember to convert hours to minutes by multiplying by 60. The algorithm could look like this:

  1. Initialize a sum variable to 0.
  2. For each student's hours from the dataset (10, 16.75, 0, 22.5, 15, 11, 20.75, 23.75, 18.8), add it to the sum.
  3. Divide the sum by the number of students to find the total average hours per weekend.
  4. Divide this weekend average by 2 to get the average hours per day.
  5. Multiply the average hours per day by 60 to convert to minutes.
  6. Output the result as the average number of minutes spent gaming per day.

User Ironicaldiction
by
8.7k points