PROGRAM 3 / CSC2100-001

$30.00 $24.00

SPECIFICATIONS: Write a program that can be used to gather data about the number of hours college students spend on Facebook and Twitter (combined) in one month. Main Function In Main, ask the user how many students were surveyed. Main should make an array to define an array of floats with the number of elements…

Rate this product

You’ll get a: zip file solution

 

Description

Rate this product

SPECIFICATIONS:

Write a program that can be used to gather data about the number of hours college students spend on Facebook and Twitter (combined) in one month.

Main Function

  1. In Main, ask the user how many students were surveyed.

  2. Main should make an array to define an array of floats with the number of elements equal to the number of students surveyed.

  3. Main should then call a function called getFBTData to allow the user to enter the number of hours each student spent on Facebook and/or Twitter (combined) this month into the array.

  4. Main should then call a function called printArray to print out the values in the array.

  5. Main should then call a function called getMIn to get the minimum hours spent in a month.

  6. Main should then call a function called getMax to calculate and display the maximum of the values entered.

  7. Main should then call a function called getAverage to calculate and display the average of the values entered.

  1. Main should then call printAboveAvg. This function will print out all the times that are greater than the average.

  1. Main should then call printBelowAvg. This function will print out all the times that are equal to or below the average.

  2. Main should then print out a tab and then the header “STATISTICS FOR TIME SPENT ON FACEBOOK & TWITTER” in all capital letters, then skip down to the next line and then print out the average, median & mode.

    1. The labels “Average:”, “Minimum:”, and “Maximum:” should all have a colon “:” after the word.

    2. The labels and the values should all be left aligned.


getFBTData Function

Allow the user to enter the number of hours each student spent on Facebook and/or Twitter into the array. The function will accept as arguments the following:

  1. An array of floats

  2. An integer that indicates the number of elements in the array.

Input Validation: Do not accept negative numbers for input.


printArray Function

This function should print out the text “Number of hours each student spent on Facebook/Twitter: “. Then, the function should print out each element in the array with a space between each element.

The function will accept as arguments the following:

  1. An array of floats
  2. An integer that indicates the number of elements in the array.

getMin Function

The function should iterate through the array and find the minimum value which should be returned.

Write a function that accepts as arguments the following:

  1. An array of floats

  2. An integer that indicates the number of elements in the array.

getMax Function

The function should iterate through the array and find the maximum value which should be returned.

Write a function that accepts as arguments the following:

  1. An array of floats

  2. An integer that indicates the number of elements in the array.


getAverage Function

The average of a set of values is calculated by adding all the values and then dividing the sum by the number of values in the set.

Write a function that accepts as arguments the following:

  1. An array of floats

  2. An integer that indicates the number of elements in the array.

The function should determine the average of the array. The average is the value the function should return.

printAboveAvg Function

This function should print out the text “Number of hours each student spent on Facebook/Twitter that is above the average is: “. Then, the function should print out each element in the array that is greater than the average with a space between each element.

The function will accept as arguments the following:

  1. An array of floats
  2. An integer that indicates the number of elements in the array.
  1. The average time

printBelowAvg Function

This function should print out the text “Number of hours each student spent on Facebook/Twitter that are equal to or below the average is: “. Then, the function should print out each element in the array that is equal to or less than the average with a space between each element.

The function will accept as arguments the following:

  1. An array of floats
  2. An integer that indicates the number of elements in the array.
  1. The average time


PROGRAM 3 / CSC2100-001
$30.00 $24.00