Question
This is IntelliJ java programming. Marathon You have a friend who wants to run a marathon race, which is 26.2 miles. Currently, your friend can
This is IntelliJ java programming.
Marathon You have a friend who wants to run a marathon race, which is 26.2 miles. Currently, your friend can run exactly 1 mile. Your friend's plan is to try to run 10% further every week, until they can run the entire marathon distance.
So in the first week of training, they will run 1 mile; second week 1.1 miles, third week 1.21 miles Use a loop to calculate the distance they need to run every week until they can run the full 26.2 miles. How many weeks until your friend can run an entire marathon?
Can you use string formatting to display the weekly distances to 2 decimal places?
Once you've written this program, perhaps your friend thinks this schedule is too slow. Your friend wants to see if they can get to the marathon distance faster by increasing their distance by 5% every week? Or even 1% every week? How does that affect the number of weeks needed?
Extract the weekly schedule part of the code into a method. Use your method to calculate and display the schedules and total weeks for 1% 5% and 10%.
Extra question: what if your friend decides they want to train for a 10 mile race? Or a 100 mile race? Also extract the goal distance, so now your method takes two arguments: the percentage increase every week, and the goal distance.
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