Question: 2. A skeleton Oberon module mdCalc.m for calculating the mean deviation of a data set is in this directory. Fill in the missing code. The

2. A skeleton Oberon module mdCalc.m for calculating the mean deviation of a data set is in this directory. Fill in the missing code.

The mean deviation of the data set 2, 5, 7, 10, 12, 14 is 3.6667, and the standard deviation is 4.5019.

MODULE mdCalc; IMPORT In, Out; VAR d: ARRAY 100 OF REAL; n: INTEGER; v: REAL;

PROCEDURE mdev( x: ARRAY OF REAL; n: INTEGER): REAL; VAR

PROCEDURE mean( x: ARRAY OF REAL; n: INTEGER): REAL; VAR

BEGIN (* mean *)

RETURN m END mean;

BEGIN (* mdev *)

RETURN md END mdev;

BEGIN (* mdCalc *) n := -1; In.Real( v); WHILE In.Done DO (* exit loop with cntrl-D *) INC( n); d[ n] := v; In.Real( v) END; INC( n); (* so n is now the size of the array *) Out.Real( mdev( d, n)); Out.Ln END mdCalc.

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!