Question: in java Question Completion Status: [CLO-2Given the following classes Meal, Mealplan, and Main, what is the output of running the main class? public class Meal


Question Completion Status: [CLO-2Given the following classes Meal, Mealplan, and Main, what is the output of running the main class? public class Meal Plan private int total; private char gender; private int limit: private Meall meals: public Meal Plan (char gender, int num) { this.gender - gender: if (gender) limit - 1500: } else if (gender = E) limit = 1200: public class Meal private int calories: private boolean healthy: public Meal() this(300, true); > public Meal (int calories, boolean healthy 1 this.calories - calories: this.healthy - healthy: 1 meals - new Meal [num] : public int getCalories) return calories: 3 public vosd add (Meal m) int 101 while else return "You ace" + calories + " calories of unhealthy food" total +- m.getCalories(); public void printplan int - 0 while (meals.length 66 menis) 501) System.out.println (mealst11.coString(): 1++ 1 (total > 15ml Syatem.out.println("ota 13" - total exceeding your ) oblio das Main public static void main(String[] args) Meal Plan mylan neu Meal Plan (11 myPlan.add(new Meal (200, true): myPlan.add(new Meal (200. False yan.add(new Meal 1300, true) mylan.addnew Me! myPlan.print Plan System.ouo.pranin "Tota 16 boca than you" estion Completion Status: public void printPlan () { int 10; while (1 cmeals.length && meals (1) != null) { Syatem.out.println (meals[i].toString(); 1+: > if (total > limit) System.out.println("Total 13 " + total + "exceeding your limit"); } elset System.out.println("Total 13" + total + " within your limit": } public class Main public static void main(String[] args) { Mealplan my Plan = new Meal Plan 4) myPlan.add(new Meal (200, true)) : myPlan.add(new Meal (200, false): myPlan.add(new Meal (900, true)); mypian.add(new Meal: myPlan.printPlant); For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). B IV S Paragraph v Arial v 2 A 14px II Moving to another question will save this response
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
