SDUT JAVA lab 2.2

简介: SDUT JAVA lab 2.2

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+".");
}
}
目录
相关文章
|
Java
sdut java lab 7.1(法二好理解)
sdut java lab 7.1(法二好理解)
99 1
|
Java 应用服务中间件 AHAS
sdut java lab6主观题
sdut java lab6主观题
98 0
|
人工智能 Java
sdut java lab5
sdut java lab5
84 0
|
Java
SDUT JAVA lab3.9
SDUT JAVA lab3.9
97 2
|
Java
java lab 8------7-1 sdut-JAVA-a contacts list(s)(multi-arraylists)
java lab 8------7-1 sdut-JAVA-a contacts list(s)(multi-arraylists)
68 0
|
Java
SDUT Java lab6
SDUT Java lab6
54 0
|
Java
sdut java lab7单选
sdut java lab7单选
88 0
|
2月前
|
安全 算法 Java
Java 多线程:线程安全与同步控制的深度解析
本文介绍了 Java 多线程开发的关键技术,涵盖线程的创建与启动、线程安全问题及其解决方案,包括 synchronized 关键字、原子类和线程间通信机制。通过示例代码讲解了多线程编程中的常见问题与优化方法,帮助开发者提升程序性能与稳定性。
130 0
|
2月前
|
Java API 调度
从阻塞到畅通:Java虚拟线程开启并发新纪元
从阻塞到畅通:Java虚拟线程开启并发新纪元
284 83

热门文章

最新文章