200字
2026-09-22 课堂任务与课后作业
2026-09-22
2026-09-22

程序运行网站:

https://www.jyshare.com/compile/10/

课堂任务:

You are developing a grade management system and need to determine whether a student has passed based on their score. Your task is to practice the if-else two-branch statement.Write a Java program named PassChecker that completes the following tasks in the main method:

Step 1:Create an int variable score with the value 59; Create an int variable passLine with the value 60.

Step 2: Use an if-else two-branch statement: if score >= passLine, output "Pass" ; otherwise, output "Fail" . Step 3: Output in the following format:

课堂任务/课后作业:

You are developing a health management system and need to calculate BMI (Body Mass Index) based on the user's height and weight, and determine the weight status. Your task is to practice the if-else if-else multi-branch statement.Write a Java program named BMICalculator that completes the following tasks in the main method:

Step 1:Create a double variable weight with the value 68.0 (weight in kg); Create a double variable height with the value 1.75 (height in meters).

Step 2: Calculate BMI using the formula: BMI = weight / (height × height); Hint: Use Math.pow() to calculate the square of the height.

Step 3: Round to one decimal place — use Math.round() to round the BMI to one decimal place.

Step 4: Use a multi-branch statement to determine the weight status based on the BMI value:I

f BMI < 18.5, the status is "Underweight";

Otherwise, if BMI < 25.0, the status is "Normal";

Otherwise, if BMI < 30.0, the status is "Overweight";

Otherwise, the status is "Obese";

Step 5: Output in the following format:

请提交代码截图至问卷星https://v.wjx.cn/vm/hN6cqLb.aspx#

2026-09-22 课堂任务与课后作业
作者
Administrator
发表于
2026-09-22
License
CC BY-NC-SA 4.0