I am just asking for a little help if possible from the forums. In my program i am asked:
for a method returning the average number of miles of all cars in garage
a method returning"full" if the garage has 100 cars of more, "below minimum" if the garage has fewer than 25 cars, and "normal load" if the garage has between 25 and 100 cars in it
for a method returning the total number of gallons of gas used by all cars in garage
I know that i have to create an arraylist as a garage to hold cars with gallons of gas and miles. i have the miles and gas sorted out, but i am just stuck on how to put and relate the gallons of gas and the miles in the arrayList. If i could get any pointers, that would be appreciated. Here is my code
Code:import java.util.ArrayList; //allows usage of ArrayLists
public class Garage {
private int NumMiles;
private int Gas;
public Garage (int Miles, int GalsGas)
{
NumMiles = Miles;
Gas = GalsGas;
}
public int getMiles()
{
int returnMiles = NumMiles;
return returnMiles;
}
public int getGalsGas()
{
int returnGalsGas = Gas;
return returnGalsGas;
}
ArrayList<Integer> garage = new ArrayList<Integer>();
{
for(int i =0; i <garage.size(); i++);
}
}

