Create a Workout Manager
The project involves creating a console-based push-up workout manager in Kotlin. The goal of this manager is to guide users through a series of three push-up sets, record their performance, and adjust future workout suggestions based on their results. The program will store the suggested repetitions for the user’s next workout in a file as an additional functionality.
fun main() {val interactor = WorkoutInteractor(manager = WorkoutManager(),nextRepetitionsRepository = FileNextRepetitionsRepository(),)interactor.startWorkout()}
Within this project, the following key components are integral to the successful implementation and functionality:
The Repetitions data class
The NextRepetitionsRepository interface
The FileNextRepetitionsRepository class
The WorkoutManager class
The WorkoutInteractor class
Here is what an example conversation with a user might look like:
:::::::: First interaction :::::::::Hello, I am your push-ups workout assistant!Now do 5 push-upsHow many push-ups did you do?5Now rest for 1 minuteNow do 5 push-upsHow many push-ups did you do?4Now rest for 1 minuteNow do as many push-ups as you can!How many push-ups did you do?3Your next repetitions will be: 5 and 4:::::::: Second interaction :::::::::Hello, I am your push-ups workout assistant!Now do 5 push-upsHow many push-ups did you do?5Now rest for 1 minuteNow do 4 push-upsHow many push-ups did you do?5Now rest for 1 minuteNow do as many push-ups as you can!How many push-ups did you do?6Your next repetitions will be: 6 and 5:::::::: Third interaction :::::::::Hello, I am your push-ups workout assistant!Now do 6 push-upsHow many push-ups did you do?-1Please enter a valid number.How many push-ups did you do?0Now rest for 1 minuteNow do 5 push-upsHow many push-ups did you do?10Now rest for 1 minuteNow do as many push-ups as you can!How many push-ups did you do?0Your next repetitions will be: 5 and 4
Note: After each interaction, the code stores and retrieves values from the
next_repetitions.txtfile, allowing the workout assistant to remember the progress across sessions.
Implement proper exception handling in the FileNextRepetitionsRepository class to manage file-related exceptions.
Review your code for readability, adherence to best practices, and efficient use of Kotlin features.
In the given starting code, you have the initial setup for a console-based push-up workout manager in Kotlin. Your task is to complete the implementation by adding the necessary code for the workout manager, repetitions repository, and user interaction as per the provided specifications.
Points to remember:
Finish each task according to the instructions.
Refer to the provided solution if needed.
After successfully completing all tasks, it is crucial to run the project at the end to verify its functionality with the provided starting code in the
mainfunction.
Good luck with your implementation!