我正在编写一个程序并试图计算某人的 TDEE。这个等式在每个性别之间没有变化。要计算 TDEE,您需要将他们的活动因子和 BMR 相乘,我知道该怎么做,但活动因子是变化的,是我需要帮助的。O 需要知道如何将“如果 acLevel1 等于 0,则活动因子为 1.0”放入 java 中?但我还需要知道如果输入数据的是女性,我将如何改变这一点,因为活动因素因性别而异。我已经编写了大部分代码,但只需要在那一点上的帮助。
import java.util.Scanner;
public class TDEE
{
public static void main(String[] args)
{
Scanner TDEE = new Scanner(System.in);
char gender;
char acLevel;
double TDEEReal;
System.out.println("Enter your First and Last name: ");
String TDEE1 = TDEE.nextLine();
System.out.println("Enter your Basal Metabolic Rate: ");
double TDEE2 = TDEE.nextInt();
System.out.println("Enter your gender (M/F): ");
String gender1 = TDEE.nextLine();
gender = gender1.charAt(0);
System.out.println();
System.out.println("Select your activity level");
System.out.println("[0] Resting(Sleeping, Reclining");
System.out.println("[1] Sedentary(Minimal Activity");
System.out.println("[2] Light(Sitting, Standing)");
System.out.println("[3] Moderate(Light manual labor, Dancing, Riding a bike)");
System.out.println("[4] Very Active(Team sports, Hard manual labor)");
System.out.println("[5] Extremely Active(Full time athlete, Heavy manual labor)");
System.out.println();
System.out.print("Enter the number corresponding to your activity level: ");
String acLevel1 = TDEE.nextLine();
acLevel = acLevel1.charAt(0);
System.out.println();