It is a late night, and you decide to get a glass of milk before bed. Try to wri
ID: 3850359 • Letter: I
Question
It is a late night, and you decide to get a glass of milk before bed. Try to write pseudocode describing the process of going to the kitchen and getting the milk. Be very specific and make sure you have all actions in the correct sequence. For example, remember you must open the refrigerator door before you reach in to recieve the milk container. What if there is no glass in the cupboard? Did you check whether the glass was right side up before you started pouring? Now consider how many small decisions you make every day, and consider how involved it would be to write a program to instruct a robot to do the things you do in a day!
Explanation / Answer
Is it visible?
if no, then locate the switch and turn on the lights
navigate to kitchen
locate fridge
open its door
find milk container
put milk container on slab
close the fridge door
find glass
put glass on slab
put milk in glass until glass is full or container is empty
if container is empty
then put it in dustbin
if container is not empty
open fridge door and put it in fridge
close the door
drink the milk
put the glass in sink
navigate back to room
turn of the lights if they are on
go to bed
sleep.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.