Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Currently, the program displays the number of people whose Facebook time exceeds the number of minutes entered by the user. Modify the program to also

Currently, the program displays the number of people whose Facebook time exceeds the number of minutes entered by the user. Modify the program to also display the average number of minutes these people spend on Facebook. Display the average with one decimal place. (Hint: Three people spend more than 95 minutes on Facebook. The average for these people is 113.3 minutes.) Save and then run the program. Test the program appropriately.

#include using namespace std;

int main() { int pollResults[25]= { 35, 120, 75, 60, 20, 25, 15, 90, 85, 35, 60, 15, 10, 25, 60, 100, 90, 10, 120, 5, 40, 70, 30, 25, 5 };

int minutes = 0; int numOver = 0; double average = 0.0; double total = 0.0;

cout << "Search for minutes over: "; cin >> minutes;

//search the array for (int sub = 0; sub < 25; sub += 1) if (pollResults[sub] > minutes) numOver += 1; //end if //end for

cout << endl << "Number who spend more than " << minutes << " minutes" << endl; cout << "per day on Facebook: " << numOver << endl; return 0; } //end of main function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions