16.26 (Cooking with Healthier Ingredients) Obesity in America is increasing at a
ID: 3530987 • Letter: 1
Question
16.26 (Cooking with Healthier Ingredients) Obesity in America is increasing at an alarming rate. Check the map from the Centers for Disease Control and Prevention (CDC) at www.cdc.gov/ nccdphp/dnpa/Obesity/trend/maps/index.htm, which shows obesity trends in the United States over the last 20 years. As obesity increases, so do occurrences of related problems (e.g., heart disease, high blood pressure, high cholesterol, type 2 diabetes). Write a program that helps users choose healthier ingredients when cooking, and helps those allergic to certain foods (e.g., nuts, gluten) find substitutes. The program should read a recipe from a JTextArea and suggest healthier replacements for some of the ingredients. For simplicity, your program should assume the recipe has no abbreviations for measures such as teaspoons, cups, and tablespoons, and uses numerical digits for quantities (e.g., 1 egg, 2 cups) rather than spelling them out (one egg, two cups). Some common substitutions are shown in Fig. 16.27. Your program should display a warning such as,
Explanation / Answer
public static void main(String args[]){
findCals();
}
public void findCals(){
double k = 0.0175;//Calories/(MET*kg*minutes)
double W = 150.0;//lbs
double m = W / 2.2;//kg
double E1 = 10.0;//METS
double E2 = 8.0;//METS
double E3 = 1.0;//MET
double t1 = 30;//minutes
double t2 = 360;//minutes
double E;
E1 = k * E1 * m * t1;
E2 = k * E2 * m * t1;
E3 = k * E3 * m * t2;
E = E1 + E2 + E3;
System.out.println("The total energy expended is " + E);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.