Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are in Mars. One of your tasks is to send your robot and record temperatures

ID: 675530 • Letter: Y

Question

You are in Mars. One of your tasks is to send your robot and record temperatures in Celsius over a 20 sols period. Your robot did as instructed, and you uploaded the data to a file. In the file, the first column is what sol this is for, from 1 to 20. The second column is the temperature. For each sol, sum the data and find the average temperature. Each sol does not have the same number of temperature reading. Also find the highest temperature recorded and the lowest temperature recorded. You are in Mars. One of your tasks is to send your robot and record temperatures in Celsius over a 20 sols period. Your robot did as instructed, and you uploaded the data to a file. In the file, the first column is what sol this is for, from 1 to 20. The second column is the temperature. For each sol, sum the data and find the average temperature. Each sol does not have the same number of temperature reading. Also find the highest temperature recorded and the lowest temperature recorded.

Explanation / Answer

#include <iostream>
#include <cmath>
#include <conio.h>
using namespace std;
int main()
{
const int TEMPERATURE = 100;
float ave = 0.0;
float sdev = 0.0;
float temp_read;
float read[TEMPERATURE];
float max, maxValue;
float min, minValue;
int i;
do
{
cout << "Enter the number of Temperarure readings: ";
cin >> temp_read;
if ((temp_read < 1) || (temp_read > TEMPERATURE))
cout << "The number of readings is too high!!! Limit the number of Temperature readings to 100 ";
}
while ((temp_read< 1) || (temp_read > TEMPERATURE));
for (int i = 0;i < temp_read;i++)
{
cout << "Enter the temperature reading#" << i+1 << ": ";
cin >> read[i];
ave = ave + read[i];
}
ave = ave / temp_read;
cout << "The temperature average is: " << ave << " ";
for (int i = 0;i < temp_read;i++)
{
sdev = sdev + (read[i] - ave)*(read[i] - ave);
}
sdev = sdev / temp_read;
sdev = sqrt(sdev);
cout << "The Temperature standard deviation is: " << sdev << " ";
minValue = read[TEMPERATURE];
{
min = read[0];
for (i=0; i<TEMPERATURE; i++)
{
if (read[i]<min)
{
min = read[i];
}
}
cout << "The minimun Temperature is: " << min << endl;
};
maxValue = read[TEMPERATURE];
{
max = read[0];
for (i=0; i<TEMPERATURE; i++)
{
if (read[i]>max)
{
max = read[i];
}
}
cout << "The maximun Temperature is: " << max << endl;
};
cout << "Press any key to continue..";
getch();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote