Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm at a complete lost. I'm getting errors and I don't understand what they mean. public class MovieAudience { public static void main(String[] args, Object

I'm at a complete lost. I'm getting errors and I don't understand what they mean.

public class MovieAudience { public static void main(String[] args, Object count) {

// 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 }; int countKeyDemographic = 0; // 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); for (int i = 0; i <= 59; i++) { if (count = 18 && <= 54) { } System.out.println(count + " ages of the audience."); }

// 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); } private static int countKeyDemographic(short[] agesOfAudience) { // TODO Auto-generated method stub return 0; }

public static float average (short[] array) { float sum = 0.0f; for (int i = 0; i < array.length; i++) { //System.out.println(i + "\t" + array[i]); sum = sum + array[i]; } return sum; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

=+how the paradigm shift has taken place.

Answered: 1 week ago