Solution :
[tex]\text{Algorithm to}[/tex] stand [tex]$\etxt{up:}$[/tex]
step [tex]1[/tex]: [tex]$\text{stand}$[/tex]
step 2: [tex]\text{raise arms}[/tex]
[tex]\text{Algorithm to}[/tex] walk [tex]$\text{until it senses}$[/tex] a wall:
step [tex]1[/tex]: [tex]$\text{stand}$[/tex]
step 2: [tex]\text{raise arms}[/tex]
step 3: [tex]$\text{wallSensed}$[/tex]=false
step 4: [tex]$\text{numberOfSteps}$[/tex] = 0
step 5: if([tex]$\text{wallSensed}$[/tex]==true) then
[tex]\text{lower arms}[/tex]
step
else
if(sense)
[tex]$\text{wallSensed}$[/tex]=true;
else
step
[tex]$\text{numberOfSteps}$[/tex]++;
step 6: display [tex]$\text{numberOfSteps}$[/tex] to reach the wall
[tex]\text{Algorithm to}[/tex] turn around:
Step [tex]1[/tex]: if([tex]$\text{wallSensed}$[/tex]==true) then
turn
[tex]\text{raise arms}[/tex]
turn
[tex]\text{Algorithm to}[/tex] walk back[tex]$\text{ to the chair}$[/tex]:
Step [tex]1[/tex]: [tex]$\text{turn around}$[/tex]
Step 2: for i=[tex]1[/tex] to [tex]$\text{numberOfSteps}$[/tex] do
step
[tex]\text{Algorithm to}[/tex] sit back down:
Step [tex]1[/tex]: sit
Step 2: Lower arms