Working code implemented in C and comments for better understanding:
Code for main.c:
//include required header files
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//declare array size
#define MAX 367
//declare number of days in month in the year
int daysPerMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
30, 31 };
//Helper functions
void readDateFile(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void yearlyAverageTemperature(float Superior[], float Michigan[],
float Huron[], float Erie[],
float Ontario[], float StClair[], float avg[]);
void yearlyColdestWarmest(float avg[]);
void warmestEachLake(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void numberToDate(int num);
void coldestEachLake(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void warmestColdestOverall(float Superior[], float Michigan[],
float Huron[],
float Erie[], float Ontario[], float StClair[]);
void sort(float avg[], char lake[6][20]);
void winterAverage(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void swimComfortably(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void lakesFreeze(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
void summerAverage(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[]);
// main function
int main()
{
// Declare arrays to store temperature
float Superior[MAX], Michigan[MAX], Huron[MAX], Erie[MAX],
Ontario[MAX], StClair[MAX];
// decalre variable to store the average for each lake
float average[6];
// Call the function to read file data and store it in
respective arrays
readDateFile(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//1. Calculate the yearly average temperature
//Call the function to displays yearly average temperature of each
lake
yearlyAverageTemperature(Superior, Michigan, Huron, Erie, Ontario,
StClair, average);
//2. Calculate coldest and warmest lakes.
//Call the function to displays coldest and warmest lake
yearlyColdestWarmest(average);
//3.Call the function to displays warmest lake and day
warmestEachLake(Superior, Michigan, Huron, Erie, Ontario,
StClair);
// Call the function to displays coldest lake and day
coldestEachLake(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//4. Call the function to displays overall coldest and warmest
lake with day
warmestColdestOverall(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//5. Call the function to displays summer average of each
lake
summerAverage(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//6. Call the function to displays winter average of each
lake
winterAverage(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//7. Call the function to displays lake name having above 20
degree
swimComfortably(Superior, Michigan, Huron, Erie, Ontario,
StClair);
//8. Call the function to displays lake name having less than 0
degree
lakesFreeze(Superior, Michigan, Huron, Erie, Ontario, StClair);
}// End of main function
//Implement the function to read the data from the file
void readDateFile(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[])
{
//count num records
int i = 0;
char heading[80];
int year, day = 0;
// Creates a file pointer to open the file
glsea-temps2017_1024.dat in read mode
FILE *fpK = fopen("glsea-temps2017_1024.dat", "r");
// Checks if file is unable to open then display error
message
if (fpK == NULL)
{
// Display error message
puts("Error: Could not open the input file");
exit(0);
}// End of if
// Extracts dates from file and stores
//it in structure object
while (!feof(fpK))
{
// Extracts a temperature and stores it in counter index position
of respective arrays
fscanf(fpK, "%d %d %f %f %f %f %f %f", &year, &day,
&Superior[i], &Michigan[i], &Huron[i],
&Erie[i], &Ontario[i], &StClair[i]);
// Increase the record counter by one
i++;
}// End of while loop
// Close the file
fclose(fpK);
}// End of function
//implement method compute the yearly average temperature
void yearlyAverageTemperature(float Superior[], float Michigan[],
float Huron[],
float Erie[], float Ontario[], float StClair[], float avg[])
{
//decalre local variables
int i = 0;
float completeAverage, completeTotal = 0, tot[6] = { 0 };
// Loops for 365 days
for (i = 0; i < 363; i++)
{
tot[0] += Superior[i];
tot[1] += Michigan[i];
tot[2] += Huron[i];
tot[3] += Erie[i];
tot[4] += Ontario[i];
tot[5] += StClair[i];
}// End of for loop
//compute overall average
for (i = 0; i < 6; i++)
{
avg[i] = tot[i] / 365.0f;
}
//compute overall average for the average of lakes
completeAverage = (avg[0] + avg[1] + avg[2] + avg[2] + avg[3] +
avg[4] + avg[5]) / 7.0;
//print each average for each lake
printf("\n Superior Average = %.2f \n Michigan Average = %.2f \n
Huron Average = %.2f \
\n Erie Average = %.2f \n Ontario Average = %.2f \n StClair Average
= %.2f",
avg[0], avg[1], avg[2], avg[3], avg[4], avg[5]);
//print overall average for all the lakes
printf("\n Yearly average for all six lakes = %.2f\n\n",
completeAverage);
}// End of function
//Implement method YearlyColdestWarmest
void yearlyColdestWarmest(float avg[])
{
//compare each average and print if the lake is coldest or
warmest
if (avg[0] < avg[1] && avg[0] < avg[2] &&
avg[0] < avg[3] &&
avg[0] < avg[4] && avg[0] < avg[5])
printf("\n Coldest lake: %s \n Having average = %.2f", "Superior",
avg[0]);
else if (avg[1] < avg[2] && avg[1] < avg[3]
&& avg[1] < avg[4] &&
avg[1] < avg[5])
printf("\n Coldest lake: %s \n Having average = %.2f", "Michigan",
avg[1]);
else if (avg[2] < avg[3] && avg[2] < avg[4]
&& avg[2] < avg[5])
printf("\n Coldest lake: %s \n Having average = %.2f", "Huron",
avg[2]);
else if (avg[3] < avg[4] && avg[3] < avg[5])
printf("\n Coldest lake: %s \n Having average = %.2f", "Erie",
avg[3]);
else if (avg[4] < avg[5])
printf("\n Coldest lake: %s \n Having average = %.2f", "Ontario",
avg[4]);
else
printf("\n Coldest lake: %s \n Having average = %.2f", "StClair",
avg[5]);
if (avg[0] > avg[1] && avg[0] > avg[2] &&
avg[0] > avg[3] && avg[0] > avg[4] &&
avg[0] > avg[5])
printf("\n Warmest lake: %s \n Having average = %.2f", "Superior",
avg[0]);
else if (avg[1] > avg[2] && avg[1] > avg[3]
&& avg[1] > avg[4] && avg[1] > avg[5])
printf("\n Warmest lake: %s \n Having average = %.2f", "Michigan",
avg[1]);
else if (avg[2] > avg[3] && avg[2] > avg[4]
&& avg[2] > avg[5])
printf("\n Warmest lake: %s \n Having average = %.2f", "Huron",
avg[2]);
else if (avg[3] > avg[4] && avg[3] > avg[5])
printf("\n Warmest lake: %s \n Having average = %.2f", "Erie",
avg[3]);
else if (avg[4] > avg[5])
printf("\n Warmest lake: %s \n Having average = %.2f", "Ontario",
avg[4]);
else
printf("\n Warmest lake: %s \n Having average = %.2f", "StClair",
avg[5]);
}// End of function
//Implement method warmestEachLake
void warmestEachLake(float Superior[], float Michigan[], float
Huron[], float Erie[], float Ontario[], float StClair[])
{
int i;
float warmTempOntario, warmTempErie, warmTempHuron,
warmTempMichigan, warmTempSuperior, warmTempStClair;
warmTempOntario = warmTempErie = warmTempHuron = warmTempMichigan =
warmTempSuperior = warmTempStClair = 0.0f;
int warmDayOntario, warmDayErie, warmDayHuron, warmDayMichigan, warmDaySuperior, warmDayStClair;
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Ontario[i] > warmTempOntario)
{
warmTempOntario = Ontario[i];
warmDayOntario = i;
}// End of if condition
if (Erie[i] > warmTempErie)
{
warmTempErie = Erie[i];
warmDayErie = i;
}// End of if condition
if (Huron[i] > warmTempHuron)
{
warmTempHuron = Huron[i];
warmDayHuron = i;
}// End of if condition
if (Michigan[i] > warmTempMichigan)
{
warmTempMichigan = Michigan[i];
warmDayMichigan = i;
}// End of if condition
if (Superior[i] > warmTempSuperior)
{
warmTempSuperior = Superior[i];
warmDaySuperior = i;
}// End of if condition
if (StClair[i] > warmTempStClair)
{
warmTempStClair = StClair[i];
warmDayStClair = i;
}// End of if condition
}// End of for loop
//print the results
printf("\n\n Lake Ontario warmest water temperature %.2f ",
warmTempOntario);
numberToDate(warmDayOntario);
printf("\n Lake Erie warmest water temperature %.2f",
warmTempErie);
numberToDate(warmDayErie);
printf("\n Lake Huron warmest water temperature %.2f",
warmTempHuron);
numberToDate(warmDayHuron);
printf("\n Lake Michigan warmest water temperature %.2f ",
warmTempMichigan);
numberToDate(warmDayMichigan);
printf("\n Lake Superior warmest water temperature %.2f ",
warmTempSuperior);
numberToDate(warmDaySuperior);
printf("\n Lake StClair warmest water temperature %.2f ",
warmTempStClair);
numberToDate(warmDayStClair);
}// End of function
//Based on the day's number,
//calculate which date and month that number
void numberToDate(int num)
{
//declare local variable
int i;
for (i = 0; i < 12; i++)
{
//if the date number is greater than the number of days
//in the current month, then that date
//does not belong to this month else, it belongs to this
month.
if (num > daysPerMonth[i])
{
num -= daysPerMonth[i];
}
else
{
printf(" Day: %d/%d ", num, i + 1);
break;
}
}
}
//implement method coldestEachLake
void coldestEachLake(float Superior[], float Michigan[], float
Huron[], float Erie[],
float Ontario[], float StClair[])
{
//declare local variables
int i;
float coldTempOntario, coldTempErie, coldTempHuron,
coldTempMichigan,
coldTempSuperior, coldTempStClair;
coldTempOntario = coldTempErie = coldTempHuron =
coldTempMichigan = coldTempSuperior = coldTempStClair =
100.0;
int coldDayOntario, coldDayErie, coldDayHuron,
coldDayMichigan,
coldDaySuperior, coldDayStClair;
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Ontario[i] < coldTempOntario)
{
coldTempOntario = Ontario[i];
coldDayOntario = i;
}// End of if condition
if (Erie[i] <= coldTempErie)
{
coldTempErie = Erie[i];
coldDayErie = i;
}// End of if condition
if (Huron[i] <= coldTempHuron)
{
coldTempHuron = Huron[i];
coldDayHuron = i;
}// End of if condition
if (Michigan[i] <= coldTempMichigan)
{
coldTempMichigan = Michigan[i];
coldDayMichigan = i;
}// End of if condition
if (Superior[i] <= coldTempSuperior)
{
coldTempSuperior = Superior[i];
coldDaySuperior = i;
}// End of if condition
if (StClair[i] <= coldTempStClair)
{
coldTempStClair = StClair[i];
coldDayStClair = i;
}// End of if condition
}// End of for loop
printf("\n\n Lake Ontario coldest water temperature %.2f ",
coldTempOntario);
numberToDate(coldDayOntario);
printf("\n Lake Erie coldest water temperature %.2f",
coldTempErie);
numberToDate(coldDayErie);
printf("\n Lake Huron coldest water temperature %.2f",
coldTempHuron);
numberToDate(coldDayHuron);
printf("\n Lake Michigan coldest water temperature %.2f ",
coldTempMichigan);
numberToDate(coldDayMichigan);
printf("\n Lake Superior coldest water temperature %.2f ",
coldTempSuperior);
numberToDate(coldDaySuperior);
printf("\n Lake StClair coldest water temperature %.2f ",
coldTempStClair);
numberToDate(coldDayStClair);
}// End of function
//implement function warmestColdestOverall
void warmestColdestOverall(float Superior[], float Michigan[],
float Huron[],
float Erie[], float Ontario[], float StClair[])
{
int i;
float warmTemp = 0.0f, coldTemp = 500.0f;
int warmDay, coldDay;
char *warmLake = NULL, *coldLake = NULL;
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Ontario[i] > warmTemp)
{
warmLake = "Ontario";
warmTemp = Ontario[i];
warmDay = i;
}// End of if condition
if (Ontario[i] < coldTemp)
{
coldLake = "Ontario";
coldTemp = Ontario[i];
coldDay = i;
}// End of if condition
}// End of for loop
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Erie[i] > warmTemp)
{
warmLake = "Erie";
warmTemp = Erie[i];
warmDay = i;
}// End of if condition
if (Erie[i] < coldTemp)
{
coldLake = "Erie";
coldTemp = Erie[i];
coldDay = i;
}// End of if condition
}// End of for loop
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Huron[i] > warmTemp)
{
warmLake = "Huron";
warmTemp = Huron[i];
warmDay = i;
}// End of if condition
if (Huron[i] < coldTemp)
{
coldLake = "Huron";
coldTemp = Huron[i];
coldDay = i;
}// End of if condition
}// End of for loop
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Michigan[i] > warmTemp)
{
warmLake = "Michigan";
warmTemp = Michigan[i];
warmDay = i;
}// End of if condition
if (Michigan[i] < coldTemp)
{
coldLake = "Michigan";
coldTemp = Michigan[i];
coldDay = i;
}// End of if condition
}// End of for loop
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Superior[i] > warmTemp)
{
warmLake = "Superior";
warmTemp = Superior[i];
warmDay = i;
}// End of if condition
if (Superior[i] < coldTemp)
{
coldLake = "Superior";
coldTemp = Superior[i];
coldDay = i;
}// End of if condition
}// End of for loop
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (StClair[i] > warmTemp)
{
warmLake = "StClair";
warmTemp = StClair[i];
warmDay = i;
}// End of if condition
if (StClair[i] < coldTemp)
{
coldLake = "StClair";
coldTemp = StClair[i];
coldDay = i;
}// End of if condition
}// End of for loop
printf("\n\n Warmest water temperature overall Day: %d Lake: %s
Temperature: %.2f",
(warmDay + 1), warmLake, warmTemp);
printf("\n Coldest water temperature overall Day: %d Lake: %s
Temperature: %.2f",
(coldDay + 1), coldLake, coldTemp);
}// End of function
//sort the temperatures based on the averages
void sort(float avg[], char lake[6][20])
{
//decalre local variables
int i, j;
char templ[20];
// Loops 6 times for 6 lakes
for (i = 0; i < 6; i++)
{
// Loops till 6 minus outer loop variable (because
//after each iteration one record is sorted)
for (j = 0; j < 6 - i - 1; j++)
{
if (avg[j] < avg[j + 1])
{
float temp = avg[j];
avg[j] = avg[j + 1];
avg[j + 1] = temp;
strcpy(templ, lake[j]);
strcpy(lake[j], lake[j + 1]);
strcpy(lake[j + 1], templ);
}// End of if condition
}// End of inner for loop
}// End of outer for loop
}// End of function
//implement the function to find the summer average
void summerAverage(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[])
{
//declare local variables
int i;
float average[6];
float total[6] = { 0 };
char lake[6][20] = { "Superior", "Michigan", "Huron", "Erie",
"Ontario", "StClair" };
// Loops from 171 to 264
//(because array index position begins from 0)
for (i = 171; i < 264; i++)
{
total[0] += Superior[i];
total[1] += Michigan[i];
total[2] += Huron[i];
total[3] += Erie[i];
total[4] += Ontario[i];
total[5] += StClair[i];
}// End of for loop
// Loops 6 times for 6 lakes
for (i = 0; i < 6; i++)
{
average[i] = total[i] / (float)(265 - 172);
}
sort(average, lake);
printf("\n\n Summer Warmest to Coldest");
for (i = 0; i < 6; i++)
{
printf("\n Lake: %-20s Temperature: %.2f", lake[i],
average[i]);
}
}// End of function
//implement the fucntion to find winter average
void winterAverage(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[])
{
int i;
float average[6];
float total[6] = { 0 };
char lake[6][20] = { "Superior", "Michigan", "Huron", "Erie",
"Ontario", "StClair" };
// Loops for 79 days from 1 to 78 (because array index position
begins from 0)
for (i = 0; i < 78; i++)
{
total[0] += Superior[i];
total[1] += Michigan[i];
total[2] += Huron[i];
total[3] += Erie[i];
total[4] += Ontario[i];
total[5] += StClair[i];
}// End of for loop
// Loops for 10 days from 355 to 364 (because array index
position begins from 0)
for (i = 354; i < 364; i++)
{
total[0] += Superior[i];
total[1] += Michigan[i];
total[2] += Huron[i];
total[3] += Erie[i];
total[4] += Ontario[i];
total[5] += StClair[i];
}// End of for loop
for (i = 0; i < 6; i++)
{
average[i] = total[i] / (float)(79 + 10);
}
sort(average, lake);
printf("\n\n Winter Warmest to Coldest");
for (i = 0; i < 6; i++)
{
printf("\n Lake: %-20s Temperature: %.2f", lake[i],
average[i]);
}
}// End of function
//implement the function swimComfortably
void swimComfortably(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[])
{
//declare local variables
int i;
int days[6] = { 0 };
char lake[6][20] = { "Superior", "Michigan", "Huron", "Erie",
"Ontario", "StClair" };
// Loops for 365 days
for (i = 0; i < 365; i++)
{
if (Superior[i] > 20)
days[0]++;
if (Michigan[i] > 20)
days[1]++;
if (Huron[i] > 20)
days[2]++;
if (Erie[i] > 20)
days[3]++;
if (Ontario[i] > 20)
days[4]++;
if (StClair[i] > 20)
days[5]++;
}// End of for loop
printf("\n\n Swim comfortably in the lake ");
for (i = 0; i < 6; i++)
{
printf("\n Lake %s Days = %d", lake[i], days[i]);
}
}// End of function
//implemebt the function to compute number of days in Freeze
void lakesFreeze(float Superior[], float Michigan[], float
Huron[],
float Erie[], float Ontario[], float StClair[])
{
//declare local variables
int i;
int days[6] = { 0 };
char lake[6][20] = { "Superior", "Michigan", "Huron", "Erie",
"Ontario", "StClair" };
// Loops for 0 to 365 days
for (i = 0; i < 365; i++)
{
if (Superior[i] < 0)
days[0]++;
if (Michigan[i] < 0)
days[1]++;
if (Huron[i] < 0)
days[2]++;
if (Erie[i] < 0)
days[3]++;
if (Ontario[i] < 0)
days[4]++;
if (StClair[i] < 0)
days[5]++;
}// End of for loop
printf("\n\n Lakes freeze ");
for (i = 0; i < 6; i++)
{
printf("\n Lake %s Days = %d", lake[i], days[i]);
}
printf("\n\n");
}// End of function
Output Screenshots:


Hope it helps. Thank you.
On this project you will make calculations and conclusions based on real data collected by the...
On this project you will make calculations and conclusions based on real data collected by the NOAA (The National Oceanic and Atmospheric Administration, an agency of the United States government) on the “Daily Lake Average Surface Water Temperature” of six lakes (Ontario, Erie, Huron, Michigan, Superior, and St. Clair) during the 2017 calendar year. You can find the actual data file here that contain the average temperatures for each day of the year for each of the six lakes. Data...
https://coastwatch.glerl.noaa.gov/ftp/glsea/avgtemps/2020/glsea-temps2020_1024.datIt is up to you to extract the data from the file and put it into MATLAB. This operation must be done with MATLAB! Do not copy and enter data by hand! You are to make a report showing tables, graphs and conclusions based on data using MATLAB functionality. Required elements: The entire project must be presented as one single script file . Divide your codes into sections, one for each question, and add text comments to identify which question...
Write a C++ program that demonstrates use of programmer-defined
data structures (structs), an array of structs,
passing an array of structs to a function, and returning a struct
as the value of a function. A function in the program should read
several rows of data from a text file. (The data file should
accompany this assignment.) Each row of the file contains a month
name, a high temperature, and a low temperature. The main program
should call another function which...
please help in python
Suppose you have been tasked to write a Python program that will accomplish the following tasks as related to the daily gas prices for the past year (365 days): • display the five (5) lowest gas prices for the year • display the five (5) highest gas prices for the year • allow the user to search for a specific gas price in the list; you should display a message for whether or not you found...
Problem: You will write a program to compute some statistics based on monthly average temperatures for a given month in each of the years 1901 to 2016. The data for the average August temperatures in the US has been downloaded from the Climate Change Knowledge Portal, and placed in a file named “tempAugData.txt”, available on the class website. The file contains a sequence of 116 values. The temperatures are in order, so that the first one is for 1901, the...
Write a program that demonstrates use of programmer - defined
data structures. Please provide code! Thank you.
Here are the temps given:
January 47 36
February 51 37
March 57 39
April 62 43
May 69 48
June 73 52
July 81 56
August 83 57
September 81 52
October 64 46
November 52 41
December 45 35
Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...
Problem: You will write a program a C++ to compute some statistics based on monthly average temperatures for a given month in each of the years 1901 to 2016. The data for the average August temperatures in the US has been downloaded from the Climate Change Knowledge Portal, and placed in a file named “tempAugData.txt”, available on the class website. The file contains a sequence of 116 values. The temperatures are in order, so that the first one is for...
Problem: A local amateur meteorologist has been recording daily high temperatures throughout the month of June. He would like you to write a program to compute some statistics based on the data he has collected. He has placed each daily high temperature on a separate line in a file named “summer_temps.txt”. The high temperatures are in order so that the first one is for June 1, the second is for June 2, and so on. The statistics that the meteorologist...
package week_4; import static input.InputUtils.*; /** * You are a runner, and you are in training for a race. You'd like to keep track of all of your times for your training runs. You only like to run around lakes. Here's some example data. For this program, we'll assume that these are decimal values of minutes, not minutes and seconds, and the math will be more straightforward. Cedar, 45.15 Cedar, 43.32 Harriet, 49.34 Harriet, 44.43 Harriet, 46.22 Como, 32.11 Como,...
In this project you will create a console C++ program that will have the user to enter Celsius temperature readings for anywhere between 1 and 365 days and store them in a dynamically allocated array, then display a report showing both the Celsius and Fahrenheit temperatures for each day entered. This program will require the use of pointers and dynamic memory allocation. Getting and Storing User Input: For this you will ask the user how many days’ worth of temperature...