Question
hey so i have this portion of the code done for the calorie intake public class MyCalorieTracker { public static void main(String[] args) { printDescription();
hey so i have this portion of the code done for the calorie intake
public class MyCalorieTracker {
public static void main(String[] args) { printDescription();
Scanner sc = new Scanner(System.in); int calorieGoal = 0;
System.out.print("What is your calorie goal for the day?"); calorieGoal = sc.nextInt(); System.out.println();
System.out.println("Information for Day #1:"); int mealCount = getMealsAte(sc); int totalCalorieConsumed = getTotalCalorieIntake(sc, mealCount); System.out.println(" Total caloric intake = " + totalCalorieConsumed);
int activeLevel = getActivityLevel(sc); System.out.println("Estimated active caloric burn = ");
if (totalCalorieConsumed - calorieGoal > 0) { System.out.print(totalCalorieConsumed - calorieGoal); } else { System.out.print(0); }
System.out.println("Information for Day #2");
mealCount = getMealsAte(sc); totalCalorieConsumed = getTotalCalorieIntake(sc, mealCount); System.out.println(" Total caloric intake = " + totalCalorieConsumed); activeLevel = getActivityLevel(sc); System.out.println("Estimated active caloric burn = "); if (totalCalorieConsumed - calorieGoal > 0) { System.out.print(totalCalorieConsumed - calorieGoal); } else { System.out.print(0); } }
public static int getMealsAte(Scanner scanner) { System.out.print("how many meals did you eat? "); int answer = scanner.nextInt(); System.out.println(); return answer; }
public static void printDescription() { System.out.println("This program compares your daily caloric intake"); System.out.println("for two days and determines which day was better"); System.out.print("in regards to reaching your fitness goals."); System.out.println(); System.out.println(); }
public static int getTotalCalorieIntake(Scanner scanner, int mealCount) { int totalCalorieConsumed = 0;
for (int times = 1; times <= mealCount; times++) { System.out.print(" how many calories were consumed in meal " + times + "? "); totalCalorieConsumed += scanner.nextInt(); }
return totalCalorieConsumed; }
public static int getActivityLevel(Scanner scanner) { System.out.println("what was your activity level? "); System.out.println("1) not active"); System.out.println("2) lightly active"); System.out.println("3) active"); System.out.println("4) very active?");
int level = scanner.nextInt(); return level; } //public static double calcAvg(double day1, double day2) { //return (day1 + day2) / 2.0); } //}
( THIS IS THE SAMPLE OUTPUT): http://prntscr.com/mfgvsa
i need help with the activity level portion for this part http://prntscr.com/mfgvyh
also including the discalimer portion
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started