public class AnnualFuelUseTester
{
public static void main (String[] Args)
{
AnnualFuelUse[] aFUT = { new AnnualFuelUse(1, 45023, 45231, 10.00, 2.95),
new AnnualFuelUse(4, 45231, 45480, 11.70, 2.99),
new AnnualFuelUse(8, 45480, 45659, 9.30, 2.99)
};
double [] mpg = new double[3];
double [] cost = new double[3];
double [] distance = new double[3];
for(int i = 0; i < distance.length; i++)
{
aFUT[i].calcDistance();
distance[i] = aFUT[i].getDistance();
}
for(int i = 0; i < mpg.length; i++)
{
aFUT[i].calcMPG();
mpg[i] = aFUT[i].getMPG();
}
for( int i = 0; i < cost.length; i++)
{
aFUT[i].calcCosts();
cost[i] = aFUT[i].getCost();
}
double max = Double.MIN_VALUE;
double min = Double.MAX_VALUE;
for(int i = 0; i < 3; i++)
{
if( distance[i]> max)
max = distance[i];
}
for(int i = 0; i < 3; i++)
{
if( distance[i]< min)
min = distance[i];
}
double max1 = Double.MIN_VALUE;
double min1 = Double.MAX_VALUE;
for(int i = 0; i < 3; i++)
{
if( mpg[i]> max1)
max1 = mpg[i];
}
for(int i = 0; i < 3; i++)
{
if( mpg[i] < min1)
min1 = mpg[i] ;
}
double max2 = Double.MIN_VALUE;
double min2 = Double.MAX_VALUE;
for(int i = 0; i < 3; i++)
{
if( cost[i]> max2)
max2 = cost[i];
}
for(int i = 0; i < 3; i++)
{
if( cost[i] < min2)
min2 = cost[i] ;
}
}
}