7-2 sdut-JAVA-training heart rate
分数 10
全屏浏览
切换布局
作者 马新娟
单位 山东理工大学
It is recommended that you maintain your training heart rate during an aerobic workout. Your training heart rate is computed as .7 * (220 – a) + .3 * r, where a is your age and r is your resting heart rate (your pulse when you first wake). Write a program that declares two variables, one to store a person's age 20 and the other to store a person's resting heart rate 69.15. Assign these variables values. Calculate and display this person's training heart rate.
Input Specification:
no input.
Output Specification:
Your training heart rate is 160.745.
Sample Input:
Sample Output:
Your training heart rate is 160.745.
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
栈限制
8192 KB
public class Main { public static void main(String [] args) { int a=20; double r=69.15; double n=0.7*(220-a)+0.3*r; System.out.println("Your training heart rate is "+n+"."); } }