```
import java.util.*;
public class temp
{
public static void main (String[] args)
{
//Declear variables
int LowT=0, HighT=0, high, low, RangeT=0, zip, k, d, i;
double Avg, HighAvg=0, LowAvg=0, RangeAvg=0;
//New Scanner
Scanner input = new Scanner(System.in);
//Informs user on what the program does
System.out.println("This program calculates highest, lowest and average daily temperatures.");
//Ask user for zip
//array to get months
String[] day= {"Monday", "Tuesday", "Wensday", "Thursady", "Friday", "Saturday", "Sunday"};
d=day.length;
//Arrays for high low and ranges
int[]highest = new int [d];
int[]lowest = new int [d];
int[]ranges = new int [d];
//Ask for highest and lowest temp for each month
System.out.println("Enter the highest and lowest temperature values");
//loop to get average temps
for (k=0; k<d; k++)
{
System.out.print("Enter average high for " +day[k]+" ");
highest[k]=input.nextInt();
System.out.print("Enter the average low for " +day[k]+" ");
lowest[k]=input.nextInt();
}
//header format
String formathd = " Day Highs Lows \n";
String dashes =" ------ ----- ---- \n";
System.out.println();
//Print headers
System.out.print(formathd);
System.out.print(dashes);
String formattable= ("%10s %6d %9d \n");
//loop to output information recieved from user
for (k=0; k<d; k++)
{
System.out.printf(formattable, day[k], highest [k], lowest [k], ranges [k]);
}
//variables decleared for highest and lowest month
String hhday =" ";
String hlday =" ";
String hrday =" ";
String lhday =" ";
String llday =" ";
String lrday =" ";
//loop find highest,lowest and range of the temps
for (k=0; k<3; k++) //For loop to get high , low, and avg
{
if (k==0) //if loop to get high value and work with it
{
Avg= Mean(highest, d);
high= High(highest, d);
low= Low(highest, d);
HighAvg= Avg;
hhday= day [high];
lhday= day [low];
}
if (k==1) //If loop to get lowest value
{
Avg =Mean(lowest, d);
high= High(lowest, d);
low= Low(lowest, d);
LowAvg= Avg;
hlday= day [high];
llday= day [low];
}
if (k==2) //If loop to get average
{
Avg =Mean(ranges, d);
high= High(ranges, d);
low= Low(ranges, d);
hrday= day [high];
lrday= day [low];
}
}
//Format for results
String dailyAvg = "Daily Average";
String Highday = "Highest Day";
String Lowday = "Lowest Day";
System.out.print(dailyAvg+" "+HighAvg+" "+LowAvg+" \n");
System.out.printf(Highday+" "+hhday+" "+hlday+" "+hrday+"\n");
System.out.printf(Lowday+" "+lhday+" "+llday+" "+lrday+"\n");
}
//Method for mean
public static double Mean (int[] swap, int i)
{
double tSwap=0;
double Avg=0;
for (int k=0; k<i; k++) //For loop to add up all numbers
{
tSwap = tSwap+swap[k];
}
Avg = (double)(tSwap) / i; //Equation to get overall average
return Avg;
}
//Method for highest day
public static int High(int[] swap, int i)
{
int position = 0, greatest = swap [0];
for (int k=0; k<i; k++) //For loop to get the greatest number
{
if (swap[k]>greatest)
{
greatest=swap [k];
}
if(greatest == swap[k])
{
position = k;
}
}
return position;
}
//Method for lowest day
public static int Low(int[] swap, int i)
{
int position=0, least=swap [0]; //Declear variables
for (int k=0; k<i; k++) // For loop to determine lowest number
{
if(swap [k]<least)
{
least = swap [k];
}
if(least == swap [k])
{
position = k;
}
}
return position;
}
}
```

it is in the daily average for the high and low average i just want to reduce so i can align the table