Answer to Question #58503 in Java | JSP | JSF for Mikaylah
Question #58503
While running on a particular treadmill you can burn 3.9 calories per minute. Design a program that uses a loop to display the number of calories burned after 10, 15, 20, 25, and 30 minutes. Your output should display the number of minutes and the total number of calories burned. This is a linear activity, so the rate is constant at 3.9 calories per minute.
Expert's answer
public class Question58503 {
final static double CALORIES_PER_SECOND = 3.9;
public static void main(String[] str) {
for (int i = 10; i <= 30; i += 5) {
System.out.println(i * CALORIES_PER_SECOND + " calories burned after "
+ i + " minutes");
}
}
}
final static double CALORIES_PER_SECOND = 3.9;
public static void main(String[] str) {
for (int i = 10; i <= 30; i += 5) {
System.out.println(i * CALORIES_PER_SECOND + " calories burned after "
+ i + " minutes");
}
}
}
Need a fast expert's response?
Submit orderand get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment