Question
The BruinCard class has a MealPlan data member (named mPlan ) and includes a boolean data member (named mBoughtAMealPlan ) to track whether a MealPlan
The BruinCard class has a MealPlan data member (named mPlan) and includes a boolean data member (named mBoughtAMealPlan) to track whether a MealPlan has been purchased by this BruinCard holder.
The operations purchaseMealPlan( ... ), hasPurchasedMealPlan( ) and getPlan( ) work with these two data members accordingly. It might be the case that a BruinCard chooses not to buy any MealPlan.
When no MealPlan exists for BruinCard, calls to .eat( ... ) should always return false.
A BruinCard with a MealPlan that is used to .eat( ... ) will reduce the available number of meals left this week which is being tracked in the data member howManyMealsLeft.
BruinCards with Premier plans can be used multiple times at the same meal as long as there are available meals left in the plan.
BruinCards with Regular plans can only be used once at any specific meal on any single particular day.
The four boolean data members hasEatenBreakfast, hasEatenLunch, hasEatenDinner and hasEatenBrunch are used to track which meals have been eaten so far each day.
Premier plans provide all their meals (to either 11*11 or 11*14 or 11*19) into the howManyMealsLeft data member when startQuarter( ) is called. With calls to newWeek( ), Regular plans reset howManyMealsLeft (to either 11, 14 or 19) and any leftover meals are not carried forward. With calls to newDay( ) and newWeek( ), the four boolean data members hasEatenBreakfast, hasEatenLunch, hasEatenDinner and hasEatenBrunch should all be reset to false.
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