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

C++ problem. Please help me figure it out. I have been post this question on che

ID: 3577425 • Letter: C

Question

C++ problem. Please help me figure it out. I have been post this question on chegg many times but none of it run perfectly, so I upload the test case now.

Thank you!

The following code defines a class called WeatherForecaster and a struct called ForecastDay. Write the method to find the minimum low temperature stored in the ForecastDay array. The method should print the temperature in the minimumLowTemp method.

struct ForecastDay{

std::string day;

  int highTemp;

  int lowTemp;

};

class WeatherForecaster

{

  public:

WeatherForecaster( );

~WeatherForecaster( );

  void addDayToData(ForecastDay);

  void printDaysInData( ); //prints the unique dates in the data

void minimumLowTemp( );

  private:

  int arrayLength;

  int index;

ForecastDay yearData[100]; //data for each day

};

WeatherForecaster::WeatherForecaster()

{

//ctor

arrayLength = 100;

index = 0;

}

void WeatherForecaster::addDayToData(ForecastDay fd){

yearData[index] = fd;

index++;

}

//Your code goes here.

Answer:

Test Expected Got Weather Forecaster wf; 80 80 Forecast Day fd fd day 1/20/2000 90; fd. high Temp fd. low Temp 80 wf addDayToData (fd) wf minimum LowTemp Weather Enorecaster WF 30 80 Forecast Day fd; fd... day 1/20/2000 fd. high Temp 90 fd. low Temp 80 wf. add Day ToData (fd) fd. day 1/2/2000 fd... high Tempo 70 fd.lowTemp 30 wf DayToData (fd) add f. minimum LowTemp Weather Forecaster wf; 20 30 Forecast Day fd; fd day 1/20/2000 fd high Temp 90 fd. lowTemp 20 wf addDayToData (fd) fd. day 1/2/2000 fd. high Temp 70 fd. low Temp 30 f. addDayTo (f ToData fd day /3/2000 fd... highTemp 80 wf addDayToData (fd) wf minimum Low Temp Weather Forecaster w 50 80 Forecast Day fd; fd.day 1/20/2000 fd high Temp 90 fod... lowTemp 80 wf add DayToData (fd); fd... day 1/2/2000 fd. high Tempo 70 fd. low Tempo 50 f. addDayTo (f ToData wf minimum LowTemp

Explanation / Answer

void WeatherForecaster::minimumLowTemp( )
{
     int min=yearData[0].lowTemp;
     for(int i=0;i<index;i++)
     {
         for(int j=0;j<index;j++)
         {
         if(yearData[i].lowTemp<yearData[j].lowTemp)
         {
             min=yearData[i].lowTemp;
         }
         }
     }
     cout<<min;
}

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