Question: Problem description: Ai has an app idea. They want to create an app which will allow them to track statistics related to their daily runs.
Problem description:
Ai has an app idea. They want to create an app which will allow them to track statistics related to their
daily runs. Ai records their runs in segments. Each run is multiple segments, but not all runs are
necessarily the same number of segments. Ai records the length of each segment of the run in
kilometers, and the time of each segment in seconds. Ai stores these recordings in plain text files for
each run. Ai wants their app to take each run and output the calories they burned during the run, the
average speed of the run in mph the total distance of the run, and the total time duration of the run in
minutes.
caloriesBurnedPerMinute timeminutesMETweight kg
A metabolic equivalent for a task MET is a unit that estimates the amount of energy expended by the
body during a physical activity. MET is defined for when the body is at rest. You may use the following
table to determine MET. Round speed values to the nearest whole number.
Speed mph MET
Ai would like the app to be menu driven. The menu will have three options. Option will allow Ai to
supply a file name with data for a single run, or a directory with files for multiple runs and calculate all
the statistics for the given data. The data will then be saved in a file named after the input filedirectory
Option will allow Ai to output statistics for any previously saved runs. Option will end the program.
Ai asks that you write a prototype for their app.
Task description:
Write a Java program for Ais app idea. You should validate any user input and gracefully handle any
exceptions ie if the exception is recoverable, you should recover from it
In particular, your program should do the following:
When the program starts, prompt the user to enter their weight in kg
a You should validate the users input.
Display a menu with the three menu options and prompt the user for input.
a You should validate the users input and continue prompting the user until they enter a
valid input.
When option is chosen:
a Prompt the user for the name of a file or directory.
i Display the current working directory.
ii You should validate the users input.
iii. If they enter a name for a file or directory that does not exist, continue to
prompt for input.
b If the user enters a file name, calculate the required statistics calories burned, average
speed, total distance, and total time duration from the given file name.
c Save the statistics to a file named after the input file name in an output directory.
d If the user enters a directory name, for each file in the directory do b and c
e Return to the main menu.
When option is chosen:
a Output the contents of the output directory and prompt the user to choose a file.
i If the output directory is empty, instead prompt the user to choose option and
return to the main menu.
ii You can allow the user to enter a file name or choose a discrete menu option.
iii. You should validate the users input.
b Output the statistics in the chosen file to the console.
i The output format is shown below.
c Return to the main menu.
When option is chosen:
a Terminate the program.
Calories: Speed:
Distance: Duration:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
