write code in java and comment. thanks. the program isabout interface .
- Implement the basics of Fitness and types of Fitness:Aerobic.
- Implement specific Fitness types such as Swimming,Cycling,
Fitness Task:
public interface Fitness
(10pts) This will be used as a starting point forderiving any specific Fitness type. Every fitness exercise type hasone or more muscle group it affects. Therefor a Fitness has thefollowing abstarct method (Note that all methods in an interfaceare abstract by default):
- public Muscle [ ] muscleTargeted() A method that returns themuscle that is going to be affected by the fitness. Note that thereturn type of the method is Muscle. A human body has a finitenumber of muscle parts that can be affected by fitness exercises.Define an enum datatype called Muscle with the follwoing membervaluesAbs,Back,Biceps,Chest,Arms,Glutes,Shoulders,Triceps,Legs,Cardio
- public double calorieLoss(Intensity intensity, double weight,int duration) - returns the total amount of calorie burnt by theexercise for the duration number of minutes for a person with thegiven weight. Intensity can be HIGH, MEDIUM, LOW. Note thatIntensity is a good candidate to be definied as enum.
- public String description() a method that returns a shortdecription of the fitness type.
Aerobic Task:
(10pts) Aerobic means \"with oxygen.\" The purpose ofaerobic conditioning is to increase the amount of oxygen that isdelivered to your muscles, which allows them to work longer.Aerobic is a Fitness. However, we cannot give the actualimplementation for the methods muscleTargeted() and calorieLoss()as we don't know the actual aerobic exercise. The descripton()method returns the string Aerobic means \"with oxygen.\". Note thatAerobic is a good candidate to be abstract class.
public class Swimming, which is an Aerobic
This class represents an actual Aerobic exercise, i.e., itextends Aerobic class, that a user can do to burn calories. Thecalculation of how much calorie will be burn relies on a key valueknown as a MET, which stands for metabolic equivalent.One \"MET\" is\"roughly equivalent to the energy cost of sitting quietly,\" and canbe considered 1 kcal/kg/hour. The MET values of some of theexercises that we consider of this project are displayed in thefollowing table. The MET value multiplied by weight in kilogramstells you calories burned per hour (MET*weight inkg=calories/hour). There are different types swimming:Butterflystroke, Freestyle, and Breaststroke. These different typesof swimming activities affects different muscles. Butterflystroke:Abs,Back, Shoulders,Biceps,Triceps; Breastsstroke: Glutes, Cardio;Freestyle: Arms,Legs,Cardio.
Define a class Swimming. The class must includethe following:
- public Swimming (SwimmingType type) - defines the constructorfor the class. You need to define an enum datatype calledSwimmingTypewith membersButterflyStroke,Breaststroke,Freestyle
- public Swimming () - a default constructor for the class thatinitilizes SwimmingType to Freestyle.
- public void setSwimmingType(SwimmingType type) A setter for theswimmingType.
- public SwimmingType getSwimmingType() A getter for theswimmingType.
- @Override public String description() returns the name of theclass.
public class Cycling, which is an Aerobic
(10pts) This class represents an actual Aerobicexercise, i.e., it extends Aerobic class, that a user can do toburn calories. Cycling affects muscles: Glutes, Cardio, Legs.Define a class Cycling. The class also has:
- @Override public String description() returns the name of theclass.
| | | | |
---|
Exercise | HIGH | MEDIUM | LOW |
---|
Swimming | 10.0 | 8.3 | 6.0 |
Cycling | 14.0 | 8.5 | 4.0 |
Yoga | 4.0 | 3.0 | 2.0 |
Weightlifting | 6.0 | 5.0 | 3.5 |
Plyometrics | 7.4 | 4.8 | 2.5 |
Tai Chi | 5.0 | 3.0 | 1.5 |
Squat | 7.0 | 5.0 | 2.5 |
Pull-Up | 7.5 | 6.0 | 4.8 |