Question: public class MovieAudience { public static void main(String[] args) { // input (hard-coded) Do not change. short[] agesOfAudience = { 39, 17, 67, 15, 56,

public class MovieAudience {

public static void main(String[] args) {

// input (hard-coded) Do not change. short[] agesOfAudience = { 39, 17, 67, 15, 56, 15, 92, 25, 62, 61, 79, 42, 85, 76, 58, 41, 22, 59, 83, 84, 72, 77, 31, 48, 44, 19, 43, 98, 96, 41, 64, 27, 60, 22, 6, 99, 67, 14, 31, 15, 97, 42, 87, 62, 79, 37, 46, 30, 97, 51, 98, 43, 40, 98, 55, 70, 22, 80, 62 };

// processing // According to Wikipedia, the "key demographic" used for television // is 18 to 54. // TODO: Implement a method that will return the number of people // between 18 and 54 inclusive, found in any array passed in as an // argument. Do not change the method invocation. int numKeyDemo = countKeyDemographic(agesOfAudience);

// TODO: Implement a method that will return the average of any // array passed in as an argument. Do not change the method invocation. float avg = average(agesOfAudience);

// output // TODO: replace the two lines of code below with a method named // "displayOutput" that produces the same result System.out.println("The number in the key demo is: " + numKeyDemo); System.out.println("The average age is: " + avg); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!