Lab7 3A
Lab7 3A
lab7_3a;
import java.io.FileNotFoundException;
/**
*Emmanuel Mutomb
* LAB7_3A
* we are working on temperatures
*/
public class Lab7_3A {
month1.fillArray();
System.out.println("Month 1: "+month1);
System.out.println();
month2.fillArray();
System.out.println("Month 2: "+month2);
System.out.println();
}
}
package com.mycompany.lab7_3a;
import java.io.*;
import java.util.*;
/**
* The month temperature class
*/
}
public void findLowest()
{
for(int i=0; i<tempArray.size();i++)
{
if(tempArray.get(i)<lowest)
{
lowest=tempArray.get(i);
}
}
}
public void computeAverage()
{
double total=0;
for(double temp: tempArray)
{
total+=temp;
}
average=(double)(total/tempArray.size());
}
public String toString()
{
return "Month: " + month + ", Year: " + year + ", Highest: " + highest +",
Lowest: " + lowest + String.format("Average: %,.3f" , average);
}
}