It is important to remember program coding is not the first step ofprogramming. Too often we have a tendency to start coding too soon. As we discussed earlier, there is a great deal of planning and preparation to be done prior to sitting down to code the computer instructions to solve a problem. For the example amortization problem (fig. 1-5), we have analyzed the specifications in terms of (1) the output desired; (2) the operations and procedures required to produce the output; and (3) the input data needed. In conjunction with this analysis, we have developed a programming flowchart which outlines the procedures for taking the input data and processing it into usable output. You are now ready to code the instructions that will control the computer during processing. This requires that you know a programming language.
Before getting into the specific programming language called BASIC, itmay be helpful to have a greater understanding of programming languages in general.
All programming languages are composed of instructions that enable thecomputer to process a particular application, or perform a particular function.
The instruction is the fundamental element in program preparation. Likea sentence, an instruction consists of a subject and a predicate. However, the subject is usually not specifically mentioned; rather it is some implied part of the computer system directed to execute the command that is given. For example, the chief tells a sailor to "dump the trash." The sailor will interpret this instruction correctly even though the subject "you" is omitted. Similarly, if the computer is told to, "ADD 1234," the control unit may interpret this to mean that the arithmetic-logic unit is to add the contents of address 1234 to the contents of the accumulator.
In addition to an implied subject, every computer instruction has an ex-plicitpredicate consisting of at least two parts. The first part is referred to as the command, or operation; it answers the question "what?. " It tells the
Figure 1-5.—Problem Definition and Programming Flowchart.
computer what operation it is to perform; i.e., read, print, inpit. Each machine has a limited number of built-in operations that it is capable of executing. An operation code is used to communicate the programmer’s intent to the computer.
The second specific part of the predicate, known as the operand names the object of the operation. In general, the operand answers the question "where?." Operands may indicate the following:
1. The location where data to be processed is found.
2. The location where the result of processing is to be stored.
3. The location where the next instruction to be executed is found. (When
this type of operand is not specified, the instructions are executed in sequence.) The number of operands and the structure or format of the instructions vary from one computer to another. However, the operation always comes first in the instruction and is followed by the operand(s). The programmer must prepare instructions according to the format required by the language and the computer to be used.
Integrated Publishing, Inc.
9438 US Hwy 19N #311 Port Richey, FL 34668
Phone For Parts Inquiries: (727) 755-3260