0% found this document useful (0 votes)
15 views4 pages

Using Data Project

Uploaded by

kittu.sahoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Using Data Project

Uploaded by

kittu.sahoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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:

Monthly revenue = number of viewers * membership percent * membership fee

For example, if you have 3,000 viewers during one month and your membership percentage is
7%, then your total revenue is $1,050.

3,000 * 0.07 * 5.00 = 1,050

Here is sample data for the first six months of your streaming service:

Month Number of Viewers


January 4,010
February 4,090
March 5,025
April 5,521
May 5,101
June 4,978

You would like to determine your service's total revenue for these six months based on the
membership percentage and the monthly fee.

Part II: Coding


Create a program that calculates your monthly and total revenue for January through June.
Output the monthly revenue results along with the total revenue results to the screen.

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

4. Create prompts to prompt the user to enter the membership percentage.

5. Output the data to include the following.


a. Monthly subscribers for January through June
b. Monthly membership amounts for January through June
c. Total revenue for January through June

Expected Output
Your output may look different depending on the subscriber data and the membership
percentage entered.

**Optional Currency Formatting

To format total revenue using currency formatting, you can use the following syntax:

Intl.NumberFormat('en-US', {style: 'currency', currency:


'USD'}).format(num);

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

Intl.NumberFormat('en-US', {style: 'currency', currency:


'USD'}).format(125.59);

Returns

$125.59

Part III: Written Response

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));

2. Identify the name of the array.


The name of the array is members.
3. Describe the data in the array, what it represents in the program, and how it is used to
fulfill the program's purpose.
The members array contains the number of viewers for each month from January to June. In
this program, the data represents the total number of viewers for each month, which is used
to calculate the number of memberships by applying the user-provided membership
percentage. This step is crucial because it allows the program to determine how many
viewers subscribed to the service each month, which is then used to calculate revenue.

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.

Part IV: What to Submit


Submit the following to your instructor:
1. The .js file for your program
2. A .txt file (text file) with your program code
3. A document with your written response

Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School

You might also like