View Single Post
  (#8 (permalink)) Old
jfisher Offline
CrackBerry Addict
 
Posts: 714
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Default 06-15-2006, 04:40 AM

if this is incorrect, anyone can tell me what it should be and i'll rectify:

caloriesInt = Integer.parseInt(caloriesField.getText());
fatDouble = Double.parseDouble(fibreField.getText());
fibreDouble = Double.parseDouble(fibreField.getText());

if(fibreDouble >4){
fibreDouble = 4;
}

pointsDouble = (caloriesInt/50) + (fatDouble/12) - (fibreDouble/5);

is there a list somewhere of amounts and their corresponding points value i can test against somewhere?

edit: i've tested the above code with the data here: http://www.healthyweightforum.org/en...tchers_points/ and it works fine for everything but the quarter pounder with cheese, anyone spot the error? what the formula doesn't take into account is rounding, by comparing and contrasting it seems that to reach the final points you massivly round up...

edit2: read the above code snippet.... major error!!!!!!!! the fibre field is getting read twice.... i'll do a new build today, that's what you get when you copy 'n' paste code....

Last edited by jfisher : 06-16-2006 at 12:22 PM.