Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Example: > Profile p = new Profile(25, 1. 85, 88, Gender . MALE) ; P Age 25, Weight 88. 0kg, Height 1.9m, Gender MALE >
Example: > Profile p = new Profile(25, 1. 85, 88, Gender . MALE) ; P Age 25, Weight 88. 0kg, Height 1.9m, Gender MALE > p. calcBMI ( ) 25. 712198685171657 > p. dailyCalorieIntake( ) 2033.15 >Fitness [ ] exercises = { new Swimming( ), new Yoga( ) , new WeightLifting( )} > exercises [Swimming@7586306a, Yoga@330e4651, WeightLifting@3cb2992a] > WeeklyExercise w = new WeeklyExercise (exercises, 3, 1000, p); >w. targetedCalorieLoss ( 85 .0, 30) "You need to lose 700.00 calories per day or decrease your intake from 2033.15 to 1333.15 inorder to lose 3.00 kg of weight" >w. targetedCalorieLoss ( 85 .0, 90) "You need to lose 233.33 calories per day or decrease your intake from 2033.15 to 1799.82 inorder to lose 3.00 kg of weight" >DailyExercise [ ] exArray = w. getWeeklyExercises ( Intensity . MEDIUM) ; / / medium intensity exercise exArray [ 0 ] . getExerciseList( ) [0] / / the first day's exercise is Swimming [ Swimming @ 758b306a] > exArray [ 0 ] . getCalorieTarget( ) // splitting a 1000.0 kcal loss across 3 days yields this 333.3333333333333 > exArray [ 0 ] . getDuration( ) // it takes 27 minutes of medium-intensity swimming to achieve the 333.3 kcal loss 27 > exArray [1] . getExerciseList ( ) [1] / / the second day is Yoga [ Yoga@ 330e4651 ] > exArray [ 1] . getCalorieTarget( ) 333.3333333333333 > exArray [ 1 ] . getDuration( ) 75 >exArray [ 2 ] . getExerciseList ( ) [2] / / the third day is WeightLifting [WeightLifting@3cb2992a] >exArray [2 ] . getCalorieTarget( ) 333.3333333333333 > exArray [ 2 ] . getDuration( ) 45public class DailyExercise (20pts) This class represents the daily exercise plan. It has the list of Fitness exercises the user plans to do, the duration s/he willing to workout, and the targeted calorie loss for the day. The implementation of this class will most likely involve the use of arrays to store all of the Fitnesses for the daily workout. In addition, this class must contain: public DailyExercise (Fitness exerciseList, int duration, double calorieTarget, Profile profile) A constructor which accepts an array of exercises, number of minutes to workout and the amount of calories to be burnt. public DailyExercise (Fitness [ ] exerciseList, Profile profile) A constructor which sets duration to 1 hour and calorie Target to 500. . public int getSize( ) A method that returns the number of exercises in the exerciseList of the Daily Exercise. public void addExercise (Fitness ex) add a new Fitness in the exerciseList. public void removeExercise (Fitness ex) removes an Exercise from the exerciseList.If the exercise does not exist, it will leave the exerciseList unchanged. public void setExerciseList (Fitness [ ] list) A setter method which sets the exerciseList of the DailyExercise. public void setDuration (int duration) A setter method which sets the duration of the DailyExercise. public void setCalorieTarget (double target ) A setter method which sets the amount of calorie to be burnt of the DailyExercise. public void setProfile(Profile profile) A setter method which sets the profile of the user. public Fitness [ ] getExerciseList ( ) A getter method which returns the exerciseList of the DailyExercise. public int getDuration ( ) A getter method which returns the duration of the Daily Exercise. public double getCalorieTarget ( ) A getter method which returns the amount of calorie to be burnt of the DailyExercise. public Profile getProfile ( ) A getter method which returns the profile of the user. . public Fitness [ ] getExercises (Muscle[ ] targetMuscle) - returns an array of Fitness exercises from the exerciseList that fullfills all the target muscle groups (targetMuscle) the user wants to work on for that specific day. The method will return null if there is no exercise that targets all the muscle groups. . Add a new method in the DailyExercise class that returns an array of Fitness exercises from the exerciseList that fullfills all or some of the target muscle groups (targetMuscle) the user wants to work on for that specific day. The method will return null if there is no exercise or combination of exercises that targets all/some of the muscle groups. For example, if the targeted muscles are Arms, Cardio and the exerciseList has WeightLifting, Yoga, the method returns WeightLifting as it works on Arms. Note that none of the fitnesses fulfill both of the target muscles (only WeightLifting fulfills it partially). Use the signature: o public Fitness getAllExercises (Muscle[ ] targetMuscle)
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