: We are in the process of creating a program which will take in a
: number of customers and match them to their favourite cars based on
: a number of fields.
:
: The customers are stored as objects in an array, which is the same
: as the cars (objects in an array). We are trying to find the esiest
: was of comapring the 2 arrays which will then leave the customer
: with a number of cars which they might be interested in. Some of the
: criteria which not all objects have are, price, number of doors,
: type, MPG, colour. I am looking for some suggestions and help on how
: i could go about this. Anything will be useful
:
: ---
: ArcH
Tjheeasiest (and slowest) sorting algorithm is the bubble sort. The algorithm is well described on the wikipedia.com.
Perhaps you meant a filter. This will show only array-elements, which conform to certain criteria. This can easiest be done using a for-loop and an if-statement:
for (Car c : cars) {
if ((c.price >= customer.minPrice) && (c.price <= customer.maxPrice)) {
showCar();
}
}