subject

A modern ship
A large container ship is traversing the Atlantic Ocean. It needs to deliver a large number of containers to a port in the United States. The ship in question has recently been upgraded with some new technologies.
The most notable of this is a new robot that is being used to perform a number of tasks on the ship.
In order to do so, the robot needs to be given a set of instructions for each task that it needs to perform.
The robot's main function is to check the contents of containers.
Robot Instructions
In order to provide a better definition of the instructions, we use the capital letters X and Y.
X and Y can be any container.

The robot can perform the following instructions:

- move(X, Y)
Moves the contents of container X into container Y.

- isGreater(X, Y)
If the weight of container X is greater than the weight of container Y, execute the next instruction.
Otherwise skip the next instruction.

- isEqual(X, Y)
If the weight of container X is equal to the weight of container Y, execute the next instruction.
Otherwise skip the next instruction.

However, one needs to be very careful with these instructions. The move(X, Y) instruction requires container Y to be empty. If this is not the case, the robot will dump the contents of container Y into the water. Note that the instructions concern the contents of the container.

Unfortunately, the robot cannot read these types of text instructions, because it can only read machine instructions.
In order to execute the above instructions, it first needs to convert these instructions to this machine code.
This process is called compilation.
Containers
The ship contains a lot of stacked containers.

The next two questions will concern four containers: A, B, C and D that have been stacked on top of eachother.

In order to make the ship as stable as possible in heavy seas, the heaviest containers are put at the bottom of the stack, while the lightest are put at the top:

Container D

Empty

Container C

Second Lightest

Container B

Second Heaviest

Container A

Heaviest

We call this the default order.
The top container of this stack, container D, is empty.
If two containers X and Y weigh equally heavy, the order of X and Y does not matter.

Exercise
The containers have accidentally been improperly loaded.
The contents of container C weigh heavier than the contents of container B:

Container D
Empty
Container C
Second Heaviest
Container B
Second Lightest
Container A
HeaviestWrite a set of instructions for the robot that swaps the contents of container B and C.

You are allowed to use at most three instructions.
If less instructions are needed, you should fill the boxes with a dash (-).
(
,
)
(
,
)
(
,
)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
Check my work the microprocessor is a(n) circuit, which is designed to process data based on a set of instructions. most desktop and laptop devices contain a microprocessor based on the standard. most tablets and smartphones contain processors based on technology. a microprocessor's circuitry is designed to perform a limited number of tasks contained in its set. during processing, an instruction is loaded into the processor's unit. data is loaded into registers in the processor's where arithmetic and logic operations are performed. microprocessor performance can be measured by its speed. other factors affecting overall processing performance include word size, cache size, and instruction set complexity. most digital devices contain only one microprocessor chip, but today's multi- processors contain circuitry that supports parallel processing. computers contain various kinds of memory. random memory is a special holding area for data, program instructions, and the system. it stores data on a temporary basis until the processor makes a data request. ram is different from disk storage because it is , which means that it can hold data only when the computer power is turned on. computers also contain read- memory, which is a type of non-volatile memory that provides a set of "hard-wired" instructions, called the loader, that a computer uses to boot up.
Answers: 3
question
Computers and Technology, 22.06.2019 11:00
Lisa’s company, abc ltd., lost its biggest client and is now facing a financial crunch. most of her colleagues have resigned, but lisa decides to stay with the company and assist the management in overcoming the financial situation. which quality is lisa demonstrating? a. self-management b. cooperativeness c. responsibility d. loyalty
Answers: 2
question
Computers and Technology, 22.06.2019 16:00
If a client wants to make minor edits, what should he/she use?
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
You know the right answer?
A modern ship
A large container ship is traversing the Atlantic Ocean. It needs to deliver a l...
Questions
question
Mathematics, 23.08.2019 05:20
Questions on the website: 13722367