Question: Write a Java program that uses the array {33.5, 67.5, 67.5, 88.0, 46.0, 94.5, 77.5, 83.0, 95.0, 80.5}, but only in file called temps.txt. Even
Write a Java program that uses the array {33.5, 67.5, 67.5, 88.0, 46.0, 94.5, 77.5, 83.0, 95.0, 80.5}, but only in file called temps.txt. Even though you are using the above array as your test case, your code should still work if I substitute a different file name into your code. That different filename could possibly have 10 numbers, or 50 numbers, and your code should still work. The first number in the file will be an integer, and will indicate the amount of decimal numbers to follow. Once you have the read the from the file into an array then compute the following properties on the set of numbers: the sum, the average (mean), the variance, the standard deviation, and the median. Dont try to do the entire program at once. Build a little, test a little. Your program should contain 5 functions (methods). One method to compute the sum, a method to compute the average (mean), a method to compute the variance, a method to compute the standard deviation, and finally a method to compute the median. Think carefully about the parameters for each method. For example the method double Sum(double[] nums) might take an array as a parameter, and have a return type of double in order to return the sum of the array. The method double Average(double sum, int n) might have a parameter for sum, and a parameter for the number of numbers in the array, and a return type of double to return the decimal average. The method to compute the median should work regardless of whether n is even or odd, where n is the length of the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
