Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you please write the code in java and explain this is the result it needs to output 1. Download ComputeMeanDeviation.java from MS Methods module
can you please write the code in java and explain
1. Download ComputeMeanDeviation.java from MS Methods module in folio. 2. Modify the program by adding the following two methods: public static double mean (int boundary, int n) public atatic double deviation (int boundary, int n) In the mean method, generate n ruedom integers e[0, boumdary ], compute and return the result of the mean. In the deviation method, generate n random integers [0, boundary ], compute and return the result of the atandard deviation. The formulas to compute the mean and the standard deviation are: mean=ni=1nx1deviation=n1i=1nx12n(inx1)2 3. Rewrite the main method so that it invokes the mean and deviation methods and displays the results of the mean and the standard deviation. A sample main method is as follows. Please type this main method in your own source code. public ztatie void main (string() aege) \& (f) Find mean double meanvalue in man (99,1000) ? If Find otandard deviation doubie doviationvalue m doviacion (99,1000)1 (1) Diaplay result System. out. printin ("The mean in " + meanvalue) syatem. out.printin ("The gtandard doviation it it doviationvalue). But, before you submit your java file to Gradescope, please insert these three lines given below at the beginning of your code. package homework; import brandon.math. Random; import brandon. Eath. Math; package homehork; inport brandon, nath. fondoa; import brandon, eath. Bath; public class his l public static void min (String[] ares) \{ 1/ Find mean doudle meanValue =mean(99,1000); If Find standard deviation double deviationValue - deviation (99,1000) : If Display result Systen, cut, printin(" The mean is " meanvalue): Systeen,out, println("The standard deviation is : deviotionvalue); public static double mean (int boundory, int n) (. f/conplete on your can public static double deviation (int boundary, int n) ( froaplete on your owin Test Failed! expected: 4[9325 the standard deviation is 2858491422623691]> but was: 282836027794583881> at. junit. framework. Assert.assertEqua1s: 100 (Assert.java) at tests. Hw5Test, test1:41 (Hw5Test. Java) Test Case 2(0.0/25.0) Test, Failedi expected:49[859 the standard deviation is 29077278485513805]> but wast sthe mean 1849[351 the standard deviation is 28790926286530561 l at junit,framework. Assert.assertequals 100 (Assert,java) at testa. HW5Test, teat2:60 (Hw5Test. java) Test Case3(0.0/25.0) Test railed expectedisthe mean is 50[803 the atandard deviation is 29572089958345934]> but was: 50[307 the scandard deviation is 292748854638053 l> at junif. framework.Assert, asgertequals:100 (Assert., Java) at, teats. HW5Test, test 3:78 (HW5Test.java) this is the result it needs to output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started