Outputting information

Outputting information from a computer system is as varied as the number of devices that are available for it. What you need to be aware of is how information can be formatted and how files can be created using software tools.

Formatting to a screen is easy enough. In psuedocode you can write PRINT or OUTPUT to display something to the screen. In Java that is written as System.out.println(). When formatting the output you need to consider what information the user requires. If you output a value on it's own it will not be much help to the user. As such a message would be better. E.g to print out a variable "cash" we could write

OUTPUT cash or

OUTPUT "You have made £" + cash

File output

When outputting to a file you must follow a clear procedure -

  1. open the file
  2. find the end of the file
  3. append the data
  4. close the file

Files can be opened for read or write access. The biggest difference is that when a file is being written to it must then have a lock on it to prevent any other programs having access. This is known as a concurrency lock. Many people can read from a file but only one person can write to it. Data saved in a file is always stored as a record. The record can be either fixed length or variable.

The order of the records can serial, sequential or index sequential.