WEEK ONE : COMPUTER STUDIIES
BASIC PROGRAMMING
The full meaning of BASIC is Beginners All-purpose Symbolic Instruction Code. This programming language was developed in 1964 at Dartmouth College, U.S.A by Professors John Kemeny and Thomas Kurtz. It was centered on developing a means of teaching students a simple language for programming. It is a high level language and it consists of statements written English language and mathematical notations. BASIC programming language has many versions which include Gwbasic, Qbasic, Basica, Fox basic and Visual BASIC.
DATA TYPES IN BASIC PROGRAMMING
Data can be classified in BASIC programming language either as a numeric or character string.
While writing a BASIC programming language numerical-data names are represented by a single letter A - Z followed by a single digit (0-9).
Some examples of numerical data are A, B, K 8, Z3, etc
While writing a BASIC programming language character, data names arerepresented by a single letter of the alphabet (A-Z) followed by a dollarsymbol $.
THE PROGRAMMING PATTERN OF A BASIC PROGRAM
Every Programming Language has an Order in which they are written. This order must be followed in order to for the Program to be executed.
BASIC program pattern appears this way.
BASIC PROGRAMMING KEYWORDS
Input command allows a value, numeric, or character string to be typed at the keyboard of a computer and stored in the computer’s memory at the specified data name.
Example, INPUT X : This will allow a numeric value for x to be entered via the keyboard and stored in the memory under the data-name X
The PRINT statement allows the contents of the data name specified to be displayed on the screen.
Example: Print S (this will display a value for S on the screen).
The LET statement is an assignment statement that evaluates an arithmetic expression and stores the result.
Example: Let T = 20 (it will assign T to be 20)
The REM statement makes a remark about the program; it is usually when a formula is applied in the program. REM statement is not an executable statement.
Example: REM followed by a space in front of a line will remark the line in the program.
Data can be placed anywhere in the program before the end statement. The DATA statement tells the system that the numbers specified in the constant list are to be stored in the memory.
Example: By keying in ‘DATA’, you are to specify the data names contained in the program.
The READ statement helps values to be gotten from the DATA block. The READ statement gives meaning to the values gotten from the variable lists.
Example The variable list consists of variables separated from one another by commas that will be needed in the program.
In aspect of programming, this statement terminates/ends the program. It must be the highest numbered statement in the program.
Example: END, END IF….
Some Basic Arithmetic Operations
A constant is a quantity whose numerical value does not change and it is clearly stated. The constant values can be expressed with or without decimal points and may be either negative or positive. Some examples of constants are 100, -398, and 0.00067.
A variable is the name given to a quantity that are able to change and can assume different numerical values. Some examples of variables are T, Y, M1.
Simple BASIC Programs
We are going to write simple basic programs using BASIC programming commands like Let, Input, Print, Read and Data. We will also use Basic Arithmetic Operations
10 Let the Numbers be W1, W2, W3
20 Input “First Number,” W1
30 Input “Second Number,” W2
40 Input “Third Number,” W3
50 Let X = W1+ W2
60 Print “Sum”, X
70 End
10 Let the Numbers be X1, Y2,
20 Input “First Number,” X1
30 Input “ Second Number,” Y2
40 Let A = X1*Y2
50 Print “Product ”, A
60 End
Summary
The language was developed in 1964 at Dartmouth College,
U.S.A by Professors John Kemeny and Thomas Kurtz; '
Some basic programming language commands
CLASS EXERCISE