Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 81 Online
OpenStudy (anonymous):

Write two Java programs. First program is MyStatistics.java which contains the following static methods. You may not use existing methods provided by Java but you may invoke methods in this MyStatistics class. For example, you may use findMax and findMin to derive your range value for the findRange method.

OpenStudy (anonymous):

1. public static int findMax(int[] numbers) This method finds the maximum value from the input array named numbers. 2. public static int findMin(int[] numbers) This method finds the minimum value from the input array named numbers. 3. public static int findRange(int[] numbers) To compute the range of a set of values, simply subtract the lowest value from the highest value in the array named numbers. 4. public static int findSum(int[] numbers) This method finds the sum of all values stored in the array named numbers. 5. public static double findMean(int[] numbers) The mean of a set of values stored in the array named numbers can be found by adding the values in the array and dividing the total by the number of values. 6. public static double findMedian(int[] numbers) To find the median, first sort the values in order (You may use the sort method from the Arrays class provided by Java.) Check out the API page for its usage, and then follow one of these two procedures a. If the number of values is odd, the median is the number located in the exact middle of the array. b. If the number of values is even, the median is found by computing the mean of the two middle numbers in the sorted array. . 7. public static double findSTD(int[] numbers) The standard deviation S is computed using the formula listed above. Procedure for finding the standard deviation with this formula: a. Compute the mean first. b. Subtract the mean from each individual value to get a list of deviations of the form (x - ). You access each value in the array by subscripted array index. Remember array indices begin at 0. c. Square each of the differences obtained from step b. d. Add all of the squares obtained from step c. e. Divide the total from step d by the number (n -1), which is 1 less than the total number of values present in the array. f. Find the square root of the result of step e. Next, write another Java program named MyStatisticsDemo.java which contains the main method and performs the following tasks: a. Display your name to the screen and some info you get from the user’s computer and the date the program is executed. Use the same method you used for your previous assignment. b. Ask user for the number of nonnegative whole numbers to be entered, create an array of that length, and then ask the user to enter the numbers one at a time. c. Your program will store the numbers in an array. d. If the input number is negative. · You ignore the number (do not accept it nor use it in your calculations) · You give user a warning that an illegal negative number has entered. · Go back to your loop and ask for another input. e. After the user has entered all the numbers, your program then will invoke all the methods found in the MyStatistics class and calculate the statistics and output them to the screen all in one line with proper heading: ( printf method would work for this.) · The number of input numbers. · The largest number · The smallest number. · The sum, · The range, · The average of all the input numbers with three decimal places. · The standard deviation of the input numbers with three decimal places. · The median with 1 decimal place. · If there is no valid input, give the user this info. Decide an output statement if user does not enter any number, for example, user enters -1 for the first number. An example of output statistics from this program: Count Sum Max Min Range Median Mean STD 20 190 19 0 19 9.0 9.500 5.788

OpenStudy (anonymous):

Gblue: Is this for class 6.00? I didn't think we covered Java.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
russianmafiya: can someone help me write a love song
32 minutes ago 1 Reply 0 Medals
velmalovesshaggy145: Isnu00b4t this the opening melody to mood by 24kgoldn feat iann dior? https://voca.
34 minutes ago 7 Replies 2 Medals
arrivhn: ADD ME ON DISCORD ICYAFFL
54 minutes ago 4 Replies 1 Medal
arrivhn: whats is the accute of a cricle
1 hour ago 4 Replies 3 Medals
arrivhn: KNOCK KNOCK
1 hour ago 12 Replies 2 Medals
arrivhn: whats is 77 times 8
1 hour ago 8 Replies 1 Medal
arrivhn: heyy
1 hour ago 0 Replies 0 Medals
luhbabyliyahh: Is my daughter cute her name is zalaria (PFP)
10 minutes ago 31 Replies 1 Medal
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!