RichieD wrote: » Hi guys, I wonder if anyone could any help me come up with a function for a program im writing? So essentially I have 3 groups of customers, 1. Prefer to buy low priced Items 3. Prefer to buy high priced Items 2. Between 1 & 3 I then have a list of items which can have any price, so I need to work out a % chance of the customer buying the item. Examples Customer category 1 - Item price €1 = High chance to buy Customer category 1 - Item price €100 = low chance to buy Customer category 3 - Item price €1 = Low chance to buy Customer category 3 - Item price €100 = High chance to buy They dont need to be based on the actual amounts, just that the lower the price the more chance customer category 1 will buy it, the higher the price the higher the chance customer category 3 will buy it and 2 being in the middle ground. Any help would be appreciated. Thanks
double likelyhoodToBuy; switch(customerType) { case Customer.CHEAP: likelyhoodToBuy = 100 - (itemPrice * (100/1)); break; case Customer.MODERATE: likelyhoodToBuy = (itemPrice * (100/1)) / 2; break; case Customer.LAVISH: likelyhoodToBuy = itemPrice * (100/1); break; } return likelyhoodToBuy;