Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Program in C 8. Open Code::Blocks and start a new console application project. 9. main.c should have been created, create two new files by

image text in transcribedPlease Program in C image text in transcribed

8. Open Code::Blocks and start a new console application project. 9. main.c should have been created, create two new files by following these steps: a. Click File > New > Empty File b. You should receive a prompt to add the new file in the active project. Select "yes" and name the file stats_lib.e. c. Another popup should appear offering options to include "Debug" and "Release". Leave them both selected then click OK. You file should now be created and should be visible as part of your project. d. Repeat steps (a) through (c) once more and name the second file stats_lib.h 10. A header file should contain only function prototypes and relative macros, no source code. Copy the below function prototypes to stats_lib.h: a. float maximum(float nums[], int n); b. float minimum (float nums[], int n); c. float mean(float nums[], int n); d. float median(float nums[], int n); e. float variance(float nums[], int n); f. float standard_deviation(float nums[], int n); 11. At the top of your main.c and stats_lib.c files, include the library header file. Warning: do not copy/paste the below line or it will not work due to the ASCII interpretation of a quotation mark in Word vs Code::Blocks, type it into your source file manually. a. #include "stats_lib.h"; 12. In stats_lib.c, write the 6 statistics functions along with the code required to provide the desired calculations: a. float maximum(float nums[], int n) { llyour custom code } i. This function should loop through the provided n-element array of numbers and return the largest number in the array, b. float minimum(float nums[], int n) { //your custom code } i. This function should loop through the provided n-element array of numbers and return the smallest number in the array. c. float mean(float nums[], int n) { //your custom code } i. This function should calculate and return the mean of the provided length-element array of numbers. d. float median(float nums[], int n) { Ilyour custom code } i. This function should sort the provided n-element array of numbers and return the number at the n/2 index of the sorted array. e. float variance(float nums[], int n) { llyour custom code } i. This function should calculate and return the variance of the data set using the following equation, where s is the variance of the data set, u is the mean of the data set, x is a term in the data set, and n is the number of elements in the data set. 52 (x u) n-1 f. float standard_deviation(float nums[], int n) { //your custom code } i. This function should calculate and return the standard deviation of the data set. Standard deviation is found by taking the square root of a data set's variance. HINT: call your variance(...)function inside your standard deviation(...) function. 13. In main.c, write the code necessary to read in an array of numbers from a file called "data.txt" a. This should be dynamic and loop until a file has been completely read in. Make sure to keep track of the number of elements stored, as you will need this for your statistics. 14. With data read in, call each of your statistics functions in your main() function and print the results to the console window. a. A sample data.txt is provided on BlackBoard. The expected statistics are as follows: 1. Maximum: 995 2. Minimum: 0 3. Mean: 512.79 4. Median: 510 5. Variance: 87363.60 6. Standard Deviation: 295.57 b. A different data.txt of a different length will be used during grading to validate full functionality, so make sure your program is dynamic, not a hard-coded data length

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

=+a) Does the article identify the Ws?

Answered: 1 week ago