In: Computer Science
A young child wants to jump over a puddle. The caregiver
agrees, but has conditions: “you can jump until you are tired but
you cannot jump over the puddle more than 15 times”.
Can someone write this to me in pseudo code and flow chat please
thanks
The pseudocode is given below.
This pseudocode allows the child to jump over a puddle with certain conditions.
Set isChildTired to false
Set noOfJumps to 0
While true
Increment noOfJumps by 1
Accept input from the child whether he is tired and assign it to isChildTired
If isChildTired is true
Exit the loop (Stop Jumping)
Else
Proceed with the next statement
If noOfJumps is greater than or equal to 15
Exit the loop (Stop Jumping)
Else
Proceed with the next statement (No statements follows and so continue with the next iteration of the loop)
The screenshots of the code and flowchart are provided below.