Problem Statement
You have acquired a list of the math and verbal test scores from all the children in the county.
Write a class Average that contains a method belowAvg that takes two
The composite score is defined to be the sum of a child's math and verbal scores.
Definition
- Class:
- Average
- Method:
- belowAvg
- Parameters:
- int[], int[]
- Returns:
- int
- Method signature:
- int belowAvg(int[] math, int[] verbal)
- (be sure your method is public)
Notes
- each element of math corresponds to the element with the same index in verbal.
- the number of children is the length of math and verbal.
Constraints
- math and verbal will contain the same number of elements.
- math will contain between 1 and 50 elements, inclusive.
- each value in math and in verbal is between 200 and 800, inclusive.
Examples
{200,250,700,700}
{400,400,400,400}
Returns: 2
The composite scores of the 4 children are 600, 650, 1100, and 1100 and the average composite score is 862.5, so 2 of the children are below average.
{500,400}
{300,400}
Returns: 0
Both children have the same composite score 800 which is also the average. Neither are below average
{293}
{799}
Returns: 0
{400,400,400,400,400,400,401}
{400,400,400,400,400,400,400}
Returns: 6
The average composite score is just above 800, so 6 of the 7 children are below average.
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
Returns: 0
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,708,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
Returns: 49
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,706,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
{707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707}
Returns: 1
{800,300,799}
{800,800,800}
Returns: 1
{350,350,450}
{350,450,450}
Returns: 1
{350,351,450}
{350,448,450}
Returns: 2
{249,250,250,250,250,250,250,250,250,250,250,250,249,253,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,249}
{250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250}
Returns: 3
{400,400,400,401}
{400,400,400,400}
Returns: 3
{200,300,250,400}
{200,400,640,245}
Returns: 2
{400,400,400,401}
{400,400,400,400}
Returns: 3
{400,400,400,400,400,400,401}
{400,400,400,400,400,400,400}
Returns: 6
{400,400}
{400,400}
Returns: 0
{300,300,300}
{300,302,305}
Returns: 2
{400,400,401}
{400,400,400}
Returns: 2
{400,400,400,400,400,400,401}
{400,400,400,400,400,400,400}
Returns: 6
{400,400,400,400,400,400,401}
{400,400,400,400,400,400,400}
Returns: 6
{400,400}
{400,401}
Returns: 1
{400,400,400,400,400,400,401}
{400,400,400,400,400,400,400}
Returns: 6
{200,200,800}
{200,200,800}
Returns: 2
{300,300,300}
{300,302,305}
Returns: 2
{200,200,201}
{200,200,200}
Returns: 2
{200}
{200}
Returns: 0
{201,200,200,200,200}
{200,200,200,200,200}
Returns: 4
{200,201}
{200,200}
Returns: 1
{200,201}
{200,201}
Returns: 1
{200,200,201}
{200,200,200}
Returns: 2
{551,440,400}
{410,440,400}
Returns: 2
{300,500,500}
{300,500,500}
Returns: 1
{201,200,200,200,200}
{200,200,200,200,200}
Returns: 4
{551,440,400}
{410,440,400}
Returns: 2
{300,301}
{300,300}
Returns: 1
{200,200,201}
{200,200,200}
Returns: 2
{200,200,201}
{200,200,200}
Returns: 2
{ 400, 400, 400, 400, 400, 400, 401 }
{ 400, 400, 400, 400, 400, 400, 400 }
Returns: 6
{ 400, 600, 800 }
{ 400, 600, 800 }
Returns: 1