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

Write a program using structures to store the following weather information: Tot

ID: 3690042 • Letter: W

Question

Write a program using structures to store the following weather information: Total Rainfall High Temperature Low Temperature Average Temperature The program should have an array of 12 structures to hold the weather data (the average temperature should be calculated). Once the data for all the months is entered, the program should calculate and display the average monthly rainfall, total rainfall for the year, highest and lowest temps for the year (and the months they happen in) and the average of all the months average temperatures. Input temps should be between -100 and +140 and and total rainfall must not be less than 0

Explanation / Answer

  

public class CalculateArrayAverageTemperature {

  public static void main(String[] args) {

  int[] numbers = new int[]{10,20,15,25,16,60,100,-10,-53,120,13,97};

  

int max=0

int min =0;

  int sum = 0;

  for(int i=0; i < numbers.length ; i++)

sum = sum + numbers[i];

  

  double average = sum / numbers.length;

  System.out.println("Average tempetarure is : " + average);

max = numbers[i]

System.out.println("maximun temperature in array is : " +max);

System.out.println("the lowest temperature in the year is : " +min);

}

}

int max = max.MIN_VALUE;
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