Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the algorithm to program the Mechanical Man to carry out the following objectives: 1) Begin sitting in a chair at an unknown integer number

Write the algorithm to program the Mechanical Man to carry out the following objectives:

1) Begin sitting in a chair at an unknown integer number of steps from the wall with his arms lowered.

2) He will stand up and walk forward until he touches the wall with his fingertips.

3) After touching the wall, he will return to his chair.

4) Because the chair is too low for him to sense, he can get to it only by going back exactly the number of steps as he came forward.

The Mechanical man possesses the following properties:

* He is restricted to carrying out a limited set of instructions.

* He does nothing unless given a specific instruction.

* He must carry out any instructions he is given one at a time.

* He understands only the following instructions:

Physical Movement:

- Stand up

- Sit down

- Take one step

- Raise arms

- Lower arms

- Turn right 90 degrees

Arithmetic:

- Add one

- Subtract one

- Record total

Logic: The mechanical man can decide what instruction he will carry out next on the basis of answers to the following questions:

Arithmetic Results:

- Is the result positive? or negative? or zero?

- Is the result equal to a predetermined amount?

Physical status:

- Are the raised arms touching anything?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions