The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hi  Could you guys do this homework in C langauge?
I attach homework guide line and two code for this homework
It should be working
The same tutor keep suggesting higher price and to extend deadline many times
I already report you to moderator
I cannot delay this question and set up higher price
Here is the HWdate.txt
-1 3.8 -2 1.01 -3 -1.002 -4 -3.031 -5 -5.05 -9 -15 -10 -15.6 1 7.07 2 8.99 3 11.2 4 13.3 5 15.006 6 17 7 20 8 21.002 10 25.4 12 29.3 13 31.1
and Here is question2_10.c
#include <stdio.h>
#include <stdlib.h>
#define MAX_DATA_SIZE 20
int fillTheArrays(char fileName[], int x[], double y[]);
double get_average_x(int x[], int size);
double get_average_y(double y[], int size);
double calculate_slope(int x[], double x_average, double y[], double y_average, int size);
double calculate_intercept(double x_average, double y_average, double slope);
double calculate_r2(int x[], double y[], int size, double y_average, double slope, double intercept);
int main(){
int x[MAX_DATA_SIZE];
double y[MAX_DATA_SIZE];
char fileName[100];
printf("Please enter the file name: ");
gets(fileName);
// STEP 1: READING THE FILE AND FILLING THE ARRAYS x AND y
int data_size = fillTheArrays(fileName, x, y);
if (data_size == -1) {
printf("Error in reading the file.n");
fflush(stdout);
return 1;
}
// STEP 2: GETTING THE AVERAGE OF x VALUES AND y VALUES
double x_average = get_average_x(x, data_size);
double y_average = get_average_y(y, data_size);
// STEP 3: CALCULATING THE SLOPE AND INTERCEPT BASED ON THE FORMULA PROVIDED
double slope = calculate_slope(x, x_average, y, y_average, data_size);
double intercept = calculate_intercept(x_average, y_average, slope);
// STEP 4: CALCULATING THE R^2 VALUE
double r2 = calculate_r2(x, y, data_size, y_average, slope, intercept);
//STEP 5: PRINTING THE RESULTS (SLOPE, INTERCEPT AND R^2)
printf("function obtained by linear regression is 'y = %lf + %lf * x'.n", intercept, slope);
printf("value of R^2 is %lf", r2);
fflush(stdout);
return 0;
}
int fillTheArrays(char fileName[], int x[], double y[]) {}
double get_average_x(int x[], int size) {}
double get_average_y(double y[], int size) {}
double calculate_slope(int x[], double x_average, double y[], double y_average, int size) {}
double calculate_intercept(double x_average, double y_average, double slope) {}
double calculate_r2(int x[], double y[], int size, double y_average, double slope, double intercept) {}
Â
ESG 111 - Spring - 2016Assignment 10This assignment is due onMonday, May 9(Submit on Blackboard) You need to submit two .c files, containing the program, onefor each of the questions.1)Write a Rock-Paper-Scissor game:By using a Random Number Generation technique, discussed in the class, writea program which plays a rock-paper-scissor game. In this game, one player isthe computer and the other is the user.[NOTE] You are free to define as many functions as required to implement thegame.[HINT] For making random action by computer (i.e., choosing randomly amongrock, paper or scissor), you need to userand()andsrand()functions discussedin the class.Here is a sample program execution:2)Linear Regression Technique:Linear regression is a useful tool in determiningthe relationship between two variables. As an engineer or scientist, being able tofind trends in data is a necessary skill. Regression curves allow us to determinetrends that can be used in future predictions and estimates.