我正在編寫一個程序,並試圖計算某些TDEE。每個性別之間的方程不會有所不同。要計算TDEE,你需要考慮他們的活動因子和BMR,並將其乘以我知道如何去做,但活動因子是變化的,並且是我需要幫助的。 O需要知道如何將「如果acLevel1等於0,那麼活動因子爲1.0」放入java中?但是我還需要知道,如果是女性輸入數據,我將如何改變,因爲活動因素因性別而異。我編寫了大部分代碼,但只需要一點點幫助。在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();
和你的代碼中有什麼問題? – exexzian