Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions src/main/java/diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@startuml

Class FitnessApp{
+ startApp(): void
}

Class Person{
- name: String
- email: String
- workouts: ArrayList<Workout>

+ getName(): String
+ setName(name: String): void

+ getEmail(): String
+ setEmail(email: String): void

+ getWorkouts(): ArrayList<Workout>
+ setWorkouts(workouts: ArrayList<Workout>): void
}

Class Workout{
- duration: String
- date: Date
- completed: boolean
- exercise: ArrayList<Exercise>

+ getDuration(): String
+ setDuration(duration: String): void

+ getDate(): Date
+ setDate(date: Date): void

+ getCompleted(): boolean
+ setCompleted(completed: boolean): void

+ getExercise(): ArrayList<Exercise>
+ setExercise(exercise: ArrayList<Exercise>): void

+ displayWorkoutInfo(): void
}

Class Exercise{
- type: WorkoutType
- name: String
- caloriesBurned: double

+ getType(): WorkoutType
+ setType(type: WorkoutType): void

+ getCaloriesBurned(): double
+ setCaloriesBurned(caloriesBurned: double): void
}

enum WorkoutType{
CHEST
BACK
SHOULDER
ARMS
CARDIO
LEGS
}

' Relationships
FitnessApp "1" --> "*" Person : manages users
' One fitness app can contain multiple people

Person "1" --> "*" Workout : performs
' A person can complete many workouts

Workout "1" --> "*" Exercise : contains
' A workout is made up of multiple exercises

Exercise --> WorkoutType : categorized by
' Each exercise belongs to one workout type

@enduml
61 changes: 61 additions & 0 deletions src/main/java/org/codedifferently/Exercise.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.codedifferently;

// Class that represents a single exercise
public class Exercise {

// The type of exercise (ex: cardio, strength, etc.)
private ExerciseType type;

// Name of the exercise (ex: Pushups, Running)
private String name;

// Number of calories burned during the exercise
private int caloriesBurned;

// Constructor used to create a new Exercise object
public Exercise(ExerciseType type, String name, int caloriesBurned) {
this.type = type; // set exercise type
this.name = name; // set exercise name
this.caloriesBurned = caloriesBurned; // set calories burned
}

// Returns the exercise type
public ExerciseType getType() {
return type;
}

// Updates the exercise type
public void setType(ExerciseType type) {
this.type = type;
}

// Returns the name of the exercise
public String getName() {
return name;
}

// Updates the name of the exercise
public void setName(String name) {
this.name = name;
}

// Returns the number of calories burned
public int getCaloriesBurned() {
return caloriesBurned;
}

// Updates the number of calories burned
public void setCaloriesBurned(int caloriesBurned) {
this.caloriesBurned = caloriesBurned;
}

// Displays the exercise information to the console
public void displayExerciseInfo() {
System.out.println("--------------------");
System.out.println("Exercise Information");
System.out.println("Name: " + name); // print exercise name
System.out.println("Type: " + type); // print exercise type
System.out.println("Calories Burned: " + caloriesBurned); // print calories burned
System.out.println();
}
}
23 changes: 23 additions & 0 deletions src/main/java/org/codedifferently/ExerciseType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.codedifferently;

// Enum representing the different categories of exercises a workout can include
public enum ExerciseType {

// Exercises that target chest muscles
CHEST,

// Exercises that target back muscles
BACK,

// Exercises that target shoulder muscles
SHOULDERS,

// Exercises that target arm muscles
ARMS,

// Exercises focused on cardiovascular endurance
CARDIO,

// Exercises that target leg muscles
LEGS
}
Loading