A good answer might be:
|
New Example: Fat CalculatorThe answer is (I hope) obvious. It is a good idea to keep the GUI code and the application code in separate modules to help in debugging and understanding the program. This is also helpful if you later need to make changes to the program, say changing it from an application to an applet. The application code can be carried over without change. Let us develop another GUI application. The USDA recommends that the food you eat contain less than 30% of its total calories from fat. The application will calculate the percentage of calories that come from fat, given the number of grams of fat and the number of calories per serving of a food. The application will look like this:
The calculation uses the fact that fat contains 9 calories per gram. Decisions need to be made about what data type will be used for the variables and for the calculation. |
QUESTION 8:Make those decisions. Click Here after you have answered the question |