go to previous page   go to home page   hear noise   go to next page

Is your car's computer doing input and output?

Answer:

Yes—data is input from sensors, computations are performed, and the results are output to devices that control the motor.

I/O Streams

If your car's program were written in Java, it would use a specialized I/O package that manages sensors and controllers. It would not use the I/O package that deals with keyboards and terminals.

In Java, a source of input data is called an input stream and the output data is called an output stream. Think of these streams like this:

IO streams

In this picture, each "O" is supposed to be a datum (chunk of data) waiting in line to be input or leaving as output. Data input is called reading data, and data output data is called writing data (or printing data if the output stream is connected to a monitor or a printer.)

Think of the input stream as a string of pearls which the program inputs one at a time, in order. The output stream is another string of pearls (not usually the same pearls as were read in). Often a program will read several data and then combine them somehow to produce one output value. For example, the input data might be a list of numbers, the output data might be their sum.

QUESTION 3:

If the program is a text editor (like Notepad) what are the input and output data?