This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I have the folowwing part of the code. My problem is when i go to the if block,it should calculate fatCalPercent from calories and grams of fat (each gram of ffat is 9 calories),which are given as input in the textfield and display line 1,2 n 3 according to the condition that fatCalPercent <=0.30. I get the output as 0 in line 1 and line 2 displayed only once and all the other time line 3 is displayed. Please help me out.
I echo Daniel's question, and also point out that I do not see you calculating the fatCalPercent anywhere prior to your if statement. Therefore it is likely being initialized to 0, so your if statement is always true.
You are then calculating the fatCalPercent in the if statement: fatCalPercent= ((gramsofFat * 9))/(numberofCalories); It seems to me that that calculation should occur before your if statement.