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.
1
Expert's answer
2016-03-18T15:48:05-0400
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"); } } }
Comments
Leave a comment