Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Visual Studio 2015, file.c Write a program that processes numbers, corresponding to student records read in from a file, and writes the required results

Use Visual Studio 2015, file.cimage text in transcribedimage text in transcribedimage text in transcribed

Write a program that processes numbers, corresponding to student records read in from a file, and writes the required results to an output file (see main ). Your program should define the following functions: (5 pts) double read double (FILE "infile) -Reads one double precision number from the input file. Note: You may assume that the file only contains real numbers. (5 pts) int read_integer (FILE "infile) Reads one integer number from the input file (5 pts) double calculate sum (double number1, double number2, double number3, double number4, double numbers)-Finds the sum of number1, number2, number3. number4, and number5 and returns the result. (5 pts) double calculate mean (double sum, int number) Determines the mean through the calculation sum umber and returns the result. You need to check to make sure that number is not 0. If it is 0 the function returns -1.0 e i assume that we are calculating the mean of positive numbers), otherwise it returns the mean. 5 ptsi double calculate-deviation (double number, double mean) . Determines the deviation of number from the mean and returns the result. The deviation ay be calculated as number-mean. (10 pts) double calculate_variance (double deviation1, double deviation2, double deviation3, double deviation4, double deviation5, int number) Determines the variance through the calculation: ((deviation 1)"2(deviation2)"2(deviation3)"2 + (deviation4}"2 + (deviation5)" 2) / number and returns the result. Hint: you may call your calculate_mean function to determine the result! (5 pts) double calculate standard deviation double variance Calculates the standard deviation as sqrt(variance and returns the result. Recall that you may use the sqrt } function that is found in math . (10 pts) double find max (double number1, double number2, double number3, double number4, double numberS)-Determines the maximum number out of the five input parameters passed into the function, returning the max. 10 pts} double find min (double number1. double number2, double number3, double number, double numberS)-Determines the minimum number out of the five input parameters passed into the function, returning the min. 5 ptsi void print-double (FILE "outfile, double number-Prints a double precision nu ber {to the hundredths placel to an output file (20 pts) A main function that does the following (this is what the program does!!!) Opens an input file "input.dat for reading Opens an output file "output.dat for writing; Reads five records from the input file (input.dat); You will need to use a combination of read double () and read_integer () function calls here! Calculates the sum of the GPAS; Calculates the sum of the class standings; Calculates the sum of the ages; Calculates the mean of the GPAs, writing the result to the output file (output.dat) Calculates the mean of the class standings, writing the result to the output file output.dat); Calculates the mean of the ages, writing the result to the output file (output.dat) Calculates the deviation of each GPA from the mean (Hint: need to cal calculate_deviation 5 times) Calculates the variance of the GPAs Calculates the standard deviation of the GPAs, writing the result to the output file (output.dat); Determines the min of the GPAs, writing the result to the output file (output.dat Determines the max of the GPAs, writing the result to the output file (output.dat); Closes the input and output files.e. input.dat and output.dat) Write a program that processes numbers, corresponding to student records read in from a file, and writes the required results to an output file (see main ). Your program should define the following functions: (5 pts) double read double (FILE "infile) -Reads one double precision number from the input file. Note: You may assume that the file only contains real numbers. (5 pts) int read_integer (FILE "infile) Reads one integer number from the input file (5 pts) double calculate sum (double number1, double number2, double number3, double number4, double numbers)-Finds the sum of number1, number2, number3. number4, and number5 and returns the result. (5 pts) double calculate mean (double sum, int number) Determines the mean through the calculation sum umber and returns the result. You need to check to make sure that number is not 0. If it is 0 the function returns -1.0 e i assume that we are calculating the mean of positive numbers), otherwise it returns the mean. 5 ptsi double calculate-deviation (double number, double mean) . Determines the deviation of number from the mean and returns the result. The deviation ay be calculated as number-mean. (10 pts) double calculate_variance (double deviation1, double deviation2, double deviation3, double deviation4, double deviation5, int number) Determines the variance through the calculation: ((deviation 1)"2(deviation2)"2(deviation3)"2 + (deviation4}"2 + (deviation5)" 2) / number and returns the result. Hint: you may call your calculate_mean function to determine the result! (5 pts) double calculate standard deviation double variance Calculates the standard deviation as sqrt(variance and returns the result. Recall that you may use the sqrt } function that is found in math . (10 pts) double find max (double number1, double number2, double number3, double number4, double numberS)-Determines the maximum number out of the five input parameters passed into the function, returning the max. 10 pts} double find min (double number1. double number2, double number3, double number, double numberS)-Determines the minimum number out of the five input parameters passed into the function, returning the min. 5 ptsi void print-double (FILE "outfile, double number-Prints a double precision nu ber {to the hundredths placel to an output file (20 pts) A main function that does the following (this is what the program does!!!) Opens an input file "input.dat for reading Opens an output file "output.dat for writing; Reads five records from the input file (input.dat); You will need to use a combination of read double () and read_integer () function calls here! Calculates the sum of the GPAS; Calculates the sum of the class standings; Calculates the sum of the ages; Calculates the mean of the GPAs, writing the result to the output file (output.dat) Calculates the mean of the class standings, writing the result to the output file output.dat); Calculates the mean of the ages, writing the result to the output file (output.dat) Calculates the deviation of each GPA from the mean (Hint: need to cal calculate_deviation 5 times) Calculates the variance of the GPAs Calculates the standard deviation of the GPAs, writing the result to the output file (output.dat); Determines the min of the GPAs, writing the result to the output file (output.dat Determines the max of the GPAs, writing the result to the output file (output.dat); Closes the input and output files.e. input.dat and output.dat)

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago