Sorting program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Sorting program

ArchesticArchestic Posts: 25Member
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

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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:
    [code]
    for (Car c : cars) {
    if ((c.price >= customer.minPrice) && (c.price <= customer.maxPrice)) {
    showCar();
    }
    }
    [/code]
  • ArchesticArchestic Posts: 25Member
    I dont know if anyone will bble to help with this question but i keep getting thr error, "The constructor Car() is undefined".
    I dont know what could be causing this error becuase a similar piece of code is not throwing the error.
    All i have done is copied and changed the variables.

  • zibadianzibadian Posts: 6,349Member
    : I dont know if anyone will bble to help with this question but i
    : keep getting thr error, "The constructor Car() is undefined".
    : I dont know what could be causing this error becuase a similar piece
    : of code is not throwing the error.
    : All i have done is copied and changed the variables.
    :
    :
    Appearantly you don't have the null-argument constructor for your class defined. Solution:
    - Either define the null-argument constructor
    - Change the creation code to include arguments.
Sign In or Register to comment.