Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that takes its input from a file of numbers of type double. The program outputs to the screen the average and standard
Write a program that takes its input from a file of numbers of type double. The program outputs to the screen the average and standard deviation of the numbers in the file. The file contains nothing but numbers of type double separated by blanks and/or line breaks. The standard deviation of numbers n1,n2,n3 and so forth is defined as the square root of the average of the following numbers: (n1a)2,(n2a)2,(n3a)2, and so forth The number a is the average of the numbers n1,n2,n3, and so forth. If this is being done as a class assignment, obtain the file name from your instructor. (Hint: Write your program so that it first reads the entire file and computes the average of all the numbers, and then closes the file, then reopens the and computes the standard deviation.) The template is linked above, the input file name for this question is week4 1.txt. We can use the standard formula for the mean and stand deviation for this data as confirmation of our program: x1=1,x2=2,,x10=10 Average = sum over i of x[i]= =(n+1)/2, which for n=10 =5.5 Standard Deviation = =(1/count)sqrt(sumoveriof(x[i]a)2)=(1/2)sqrt((n+1)(n1)) which for n=10 =2.872281
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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