Question: 1 5 . Return the difference in times as a percentage Write a method that takes two values that represent elapsed time as arguments, finds
Return the difference in times as a percentage
Write a method that takes two values that represent elapsed time as arguments, finds the larger one, calculates the percent difference, and returns a message as a string. As we are somewhat interested in precision, you should think about how to make sure the percentages contain decimal places.
You should have noticed that the time increased as a square of the number of elements. This is notated as On Those results, as raw numbers, may be hard to interpret.
In this question you will write a method that takes two values that represent elapsed time as arguments, finds the larger one, calculates the percent difference, and returns a message as a string. As we are somewhat interested in precision, you should think about how to make sure the percentages contain decimal places.
Your output should look like one of the following for the appropriate case:
"Value is n bigger than Value
"Value is n bigger than Value
"The two values are equal."
Tip:
In reality you would most likely avoid composing the message in your percentage method and would just return the percentage as an integer. This question is constructed such that you should not modify the main method.
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
