Using Data Project
Using Data Project
Part I: Background
You recently started a streaming channel on the new streaming service, Videos Everywhere,
and collected monthly data on your active viewers. You offer a channel membership to your
viewers for $5.00 a month. Once they sign up, it is a recurring monthly subscription. You
calculate your total monthly revenue from your channel with the following formula:
For example, if you have 3,000 viewers during one month and your membership percentage is
7%, then your total revenue is $1,050.
Here is sample data for the first six months of your streaming service:
You would like to determine your service's total revenue for these six months based on the
membership percentage and the monthly fee.
1. Include comments with your name, date, and the purpose of your program at the start of
the program.
2. Create arrays to store your January through June viewer data and your monthly
membership data.
Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School
a. Place the viewer data for January through June in an array.
b. Create an empty array for the membership data.
3. Create functions to: 1) create a new array based on your January through June data, and
2) calculate the total revenue.
a. The new array should contain the number of memberships per month, based on the
membership percentage and the information in the viewer array.
b. The revenue function should use the new array described above.
i. The function should return the total revenue.
ii. Total revenue is calculated by finding the product between the sum of all the
values in the membership array and the membership fee.
iii. Round the total revenue to an appropriate dollar value
Expected Output
Your output may look different depending on the subscriber data and the membership
percentage entered.
To format total revenue using currency formatting, you can use the following syntax:
Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School
Where num is either a numerical value or variable. For example
Returns
$125.59
In the word processing program of your choice, complete the following questions. For questions
two, three, and four, your responses should be in complete sentences using proper grammar,
spelling, and punctuation.
1. Copy and paste or screen capture and paste two program code segments that contain one
of your arrays.
a. The first program code segment must include the following:
let members = [4010, 4090, 5025, 5521, 5101, 4978];
i. Shows how the data is stored in an array in the program
ii. Shows the name of the array
b. The second program code segment must show where the same array is used in the
program.
let membershipData = members.map(member => Math.round(member *
membershipPercentage));
Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School
4. Describe how using arrays helps manage the complexity of the program. Explain why the
code could not be written without an array or how it would need to be written differently
if an array was not used.
Working with arrays in the program makes it much easier to manage monthly data.
Instead of creating separate variables for each month, such as januaryViewers,
februaryViewers, etc., all the data is stored in one array, which is easier to loop through
using loops or methods like map(). The program, without arrays, would have to declare a
separate variable for each month's data. This would make calculations more cumbersome
and the code more difficult to read and maintain. Arrays enable the program to deal with
a collection of values in an orderly and effective manner.
Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School