Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 (50%) write a program to compute the mean and standard deviation of a given sequence of numbers. Assume (x,x2,x3.. xn) is the sequence. The

image text in transcribed
image text in transcribed
2" (50%) write a program to compute the mean and standard deviation of a given sequence of numbers. Assume (x,x2,x3.. xn) is the sequence. The mean of the sequence is x2xn). Alternatively, we can write it as - The standard deviation of the sequence iso-pr '/lai-r74(Xy-r)2 + + (x Larry Alternatively, we can write it as - where is the mean. Requirements (1) Your program must read the data from the file "sequence.txt". The first number of the file is an integer that tells you the length of the sequence. For example, if it's 30, then it means there are 30 numbers in the sequence (n 30). The remaining numbers are the elements of the sequence. (2) You must either display the mean and standard deviation on the screen, or (3) You must use a dynamic array with a pointer, so that your program can adapt (4) You must write a function to compute the mean, and another function to save them to a file. to different lengths of the sequence. compute the standard deviation. The main function should not have any computation. (5) You must implement the above functions in a header file (hpp), and use the include command to include it in your main source code (cpp). You cpp file should have only 1 function, which is the main function. Hints: (1) You can use power function powO and square root sqrtO.You must include (2) You can refer to the examples file 10 and struct Example 2in D2L to learn how (3) Read Page 20 to 21 on the slides of Lecture 5 to find how to declare a dynamic (4) There are three test samples for you. The first test sample has 3 numbers. The to use them. to read data from a file and how to include an h or hpp file in your cpp file. array mean is 59.3333. The standard deviation is 34.0551. The second test sample has 30 numbers. The mean is 48.79. The standard deviation is 28.8049. The third test sample has 10 numbers. The mean is 48.54. The standard deviation is 31.6925. (5) Don't forget to delete your dynamic array before the end of the program. YG 94-235 9 843288 83 8132 .8498 .757 .77 .561151 .14 . .11934 7942, 4 9 7 9 7 9 4 6 3 7 4 2 7 5 6 5 4 63945867 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions