Working on a homework assignment, honestly not even sure how to go about doing this. Any help is appreciated. Thanks!
Assignment: A drunken person leaves a bar and heads home walking. It is observed that on average he steps forward 60% of the time, steps backward 30% of the time, and wobbles (no forward or backward movements) 10% of the time.
His home is 50 feet (steps) from the bar. Write a Program called “PS1P2” that displays his movements on a typical night when he is walking home drunk. Your code should print a series of “Forward”, “Backward”, and “Wobble” words corresponding to his movements.
Hint: You may use value generated by Math.random() to determine the person’s action in each step.
Aucun commentaire:
Enregistrer un commentaire