Review the two algorithms below. Explain the difference between the two algorithms in terms of the number of times the loop body may be executed. Convert_Feet_to_Yards 1 Response = Yes 2 While (response = Yes) do Steps 3 to 7 3 Get value for feet 4 Set value of yards to (feet / 3) 5 Print the value of yards 6 Print the message ‘Do you want to convert another measure?’ 7 Get a new value for response from the user 8 Stop Convert_Feet_to_Yards 1 Do Steps 2 to 6 2 Get value for feet 3 Set value of yards to (feet / 3) 4 Print the value of yards 5 Print the message ‘Do you want to convert another measure?’ 6 Get a new value for response from the user 7 While (response = Yes) 8 Stop
Review the two
Convert_Feet_to_Yards
1 Response = Yes
2 While (response = Yes) do Steps 3 to 7
3 Get value for feet
4 Set value of yards to (feet / 3)
5 Print the value of yards
6 Print the message ‘Do you want to convert another measure?’
7 Get a new value for response from the user
8 Stop
Convert_Feet_to_Yards
1 Do Steps 2 to 6
2 Get value for feet
3 Set value of yards to (feet / 3)
4 Print the value of yards
5 Print the message ‘Do you want to convert another measure?’
6 Get a new value for response from the user
7 While (response = Yes)
8 Stop
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images