Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @Sean Wilson
- * @version 11/15/10
- */
- import java.util.Scanner;
- public class TDEE
- {
- public static void main(String[] args)
- {
- Scanner intInput = new Scanner(System.in);
- Scanner stringInput = new Scanner(System.in);
- System.out.print("Please enter your name: ");
- String name = stringInput.nextLine();
- System.out.print("Please enter your BMR: ");
- int BMR = intInput.nextInt();
- System.out.print("Please enter your Gender (M/F): ");
- String genderTemp1 = stringInput.nextLine();
- char genderTemp2 = genderTemp1.charAt(0);
- char gender = Character.toLowerCase(genderTemp2);
- if(gender !='M' || gender !='F')
- {
- System.out.print("Invalid Gender");
- }
- System.out.println("");
- System.out.println("Select Your Activity Level");
- System.out.println("[A] Resting (Sleeping, Reclining)");
- System.out.println("[B] Sedentary (Minimal Movement)");
- System.out.println("[C] Light (Sitting, Standing)");
- System.out.println("[D] Moderate (Light Manual Labor, Dancing, Riding Bike)");
- System.out.println("[E] Very Active (Team Sports, Hard Manual Labor)");
- System.out.println("[F] Extremely Active (Full-Time Athelete, Heavy Manual Labor)" + "\n");
- System.out.print("Enter the letter corresponding to your activity level: ");
- String menuChoice = stringInput.nextLine();
- System.out.println("");
- double activityFactor;
- double TDEE = BMR * activityFactor;
- if(gender=='M')
- {
- if(menuChoice.equalsIgnoreCase("A"))
- {
- activityFactor = 1.0;
- }
- else if(menuChoice.equalsIgnoreCase("B"))
- {
- activityFactor = 1.3;
- }
- else if(menuChoice.equalsIgnoreCase("C"))
- {
- activityFactor = 1.6;
- }
- else if(menuChoice.equalsIgnoreCase("D"))
- {
- activityFactor = 1.7;
- }
- else if(menuChoice.equalsIgnoreCase("E"))
- {
- activityFactor = 2.1;
- }
- else if(menuChoice.equalsIgnoreCase("F"))
- {
- activityFactor = 2.4;
- }
- else
- {
- activityFactor = 0;
- System.out.print("Invalid Menu Selection");
- }
- }
- else if(gender=='F')
- {
- if(menuChoice.equalsIgnoreCase("A"))
- {
- activityFactor = 1.0;
- }
- else if(menuChoice.equalsIgnoreCase("B"))
- {
- activityFactor = 1.3;
- }
- else if(menuChoice.equalsIgnoreCase("C"))
- {
- activityFactor = 1.5;
- }
- else if(menuChoice.equalsIgnoreCase("D"))
- {
- activityFactor = 1.6;
- }
- else if(menuChoice.equalsIgnoreCase("E"))
- {
- activityFactor = 1.9;
- }
- else if(menuChoice.equalsIgnoreCase("F"))
- {
- activityFactor = 2.2;
- }
- else
- {
- activityFactor = 0;
- System.out.print("Invalid Menu Selection");
- }
- }
- else
- {
- activityFactor = 0;
- System.out.print("Invalid Gender");
- }
- System.out.print("Name: " + name + "\t\t\tGender: " + gender + "\n");
- System.out.print("BMR: " + BMR + " calories\t\tActivity Factor: " + activityFactor + "\n");
- System.out.print("TDEE: " + TDEE + " calories");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement