Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2018) of average), except that instead of each of the data points some data points of a non-em as: arithmetic mean is similar to an

image text in transcribed
2018) of average), except that instead of each of the data points some data points of a non-em as: arithmetic mean is similar to an ordinary arithmetic mean (the mst comm contribute more than others based on their weights. Formally,heus defined contributing equally to the pty set of data (???" }having weights (wo-WyWyWp ) is defined is the weighted arithmetic mean of the elements in the array - which is equivalent to: (Wo. Wy, Wa,Wy, Ww-1) are the weights Create a program that computes the weighted average of an array of N elements following the constrains specified below: Ask the user to input the number of elements N you will store in the array Create a function that receives N, creates an array element to a random number between 0 and 100 (inclusive). This function must return the array, Call this function in your main function to initialize an array of integer called numbers - of N integer elements and initializes each - Create a function that receives N, creates an array of N double elements and initialize each element to a random floating-point number between 0.0 and 1.0. This function must returr the array. Call this function in the main function to initialize an array of floating poin numbers called weights. - Create a function that receives an array of integer numbers, an array of floating-point wei and outputs the weighted arithmetic mean, Call this function in the main function to conm the weighted arithmetic mean of your variable numbers using weights. Hint: verify what happens if you build a fraction where the numerator is a random number between 0-100 and denominator is always 100. Use this idea to generate a random tloating-point number between 0.0 and 1.0 - Print out the weighted arithmetic mean. - ewaanC)

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions