Question: output? in java Remaining Time 55 minut 5 Question completion Status alle as Marian TIVE In total private che gender private int limit private Meall
Remaining Time 55 minut 5 Question completion Status alle as Marian TIVE In total private che gender private int limit private Meall meals public Healplanehar gender, int num) this.gender - gender if (under ) mit -1500) 1 else if (gender-T) limit = 1200 puble classes private int calories private boolean healthy puble Meal this (300, true) publie Healint calories, boolean healthy this.calories - calories this.healthy healthy > publie Int get calories) return calories > meals- new Mealnum); 3 public void add(Meal m) { int 1 - 0 while i neals.length a meals[1] - null) { i. } if ( - meals.length) { System.out.println ("exceeded your planned number of meals"); } else mealsti) - M 1 total +.getCalories(); puble boolean stealthy() { return healthy > Override public String tostring) if (healthy) return "You ato" + calories + calories of healthy food". > else return "you ate + calories + calories of unhealthy food": > } } public void printPlan() { ant i = 0; while (i meals.length 46 meals[i- null) { System.out.println(mealari).toString(); 3 if (total > limit) { System.out.println("Total is total + exceeding your limit"); } else { System.out.println("Total is + total within your limit"); } public class Main public static void main(String[] args) { Mealplan myPlan - new MealPlan('M', 3) myPlan.add(new Meal (400, true)); myPlan.add(new Meal(600, true)); myPlan.add(new Meal(600, false)); myPlan.add(new Meal()); myPlan.printPlan(); > MacBook Pro
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
