Thursday 26 February 2015

BASIC Programming

PROGRAMS

All of the programs I have included give an explanation of the program after the program is listed. I have explained what each new statement is as it came up in a program. A brief description of the vocabulary I used is:
REM�makes a remark about the program.
LET�is used when a formula is used in the program.
PRINT�prints the programs results.
READ�is used with a DATA statement to read values.
DATA�is the list of values used in the READ statement.
GO TO�changes the sequence order of a program.
IF�THEN�conditional statement that decides if the program will change.
END�stops the program.
INPUT�tells the computer that information is needed to be typed into the terminal for interaction with the program.
The following vocabulary are terms used to give the computer a command:
SCR�scratch, erases the program from the terminal.
ESC�escape, stops the program from running but it doesn�t erase the program.
LIST�lists the program presently in use.
RUN�is the signal to start the computer running.
The following symbols are used:
*�multiplication
/�division
+�addition
-�subtraction


ADDITION PROGRAMS

program 1 100 REM FIND THE SUM OF THE TWO NUMBERS
200 LET A=9
300 LET B=6
400 LET C=A+B
500 PRINT A,B,C
600 END
Results:

9615

Explanation�program 1

Line 100 A �REM� statement is used to make a remark or comment about the program without affecting the program. It doesn�t matter how many �REM� statements are used in a program.
Line 200 This �LET� statement assigns the variables values.
300
Line 400 �LET� tells the computer the formula for the variables.
Line 500 �PRINT� tells the computer what to print on the terminal. The commas between the variables tell the computer how to space what is to be printed. A semicolon between the variables puts the printed material closer together.
Line 600 �END� tells the computer that the program is complete.

program 2

10 REM FIND THE PERIMETERS OF RECTANGLES 20 PRINT �TYPE IN TWO NUMBERS SEPARATED BY COMMAS�
30 INPUT A,B
40 IF A=99 THEN 90
50 LET C = 2*A + 2*B
60 PRINT �SIDE�, �SIDE�, �PERIMETER�
70 PRINT A,B,C
80 GO TO 20
90 END
Results:
TYPE IN TWO NUMBERS SEPARATED BY COMMAS

SIDE SIDE PERIMETER
5 7 24

Explanation�program 2

Line 20 �PRINT� with a message in quotation marks will print the message exactly as it is shown.
Line 30 �INPUT� tells the computer that data has to be typed into the terminal before the program will continue.
Line 40 �IF� tells the computer if the value for A=99 then go to statement 90 which will stop the program. If A= any other value the program will continue.
Line 50 When writing a formula multiplication symbols need to be used, they can�t be assumed. C = 2A + 2B will cause an error statement to appear.
Line 60 The commas that separate what is to be printed will allow for neat columns in the printed results. The words in quotation marks will be the headings for each column.
Line 80 �GO TO� tells the computer which line to continue the program on. This �GO TO� statement will allow the program to compute perimeters until the programmer is tired and types 99 into the terminal to end the program.

SUBTRACTION PROGRAMS

program 1

10 REM FIND THE ANSWER TO TEN SUBTRACTION PROBLEMS 20 LET I=1
30 READ A,B
40 LET C = A-B
50 PRINT A,B,C
60 LET I = I + 1
70 IF I $lt 11 THEN 30
80 DATA 10,6,15,9,12,7,14,5,18,9
90 DATA 11,3,6,2,13,7,6,3,9,1
100 END
Results:

1064

Explanation�program 1

Line 20 This begins the counting for the ten problems.
Line 30 �READ� will read the numbers in the �DATA� by assigning values to the variables.
Line 60 Tells the computer to do the next problem.
Line 70 �IF� tells the computer that if under eleven problems have been done then continue. Once ten problems are complete the program will end.
Line 80 �DATA� assigns values to the variables. 90

program 2

10 REM SUBTRACT TO FIND THE DIFFERENCE 20 READ A,B
30 LET C = A - B
40 PRINT A,B
50 PRINT �WHAT IS THE DIFFERENCE?�
60 INPUT C1
61 PRINT C1
70 IF C1 = C THEN 90
80 PRINT �SORRY, TRY THE NEXT ONE�
84 PRINT
85 GO TO 20
90 PRINT �VERY GOOD�
99 PRINT
100 GO TO 20
110 DATA 16,9,12,4,10,5,8,6,15,7
120 END
Results:

169
WHAT IS THE DIFFERENCE? 7
VERY GOOD

124
WHAT IS THE DIFFERENCE? 9
SORRY, TRY THE NEXT ONE
Explanation�program 2
Line 70 If the answer that was typed into the terminal was correct then �VERY GOOD� would be printed. If the answer was incorrect �SORRY, TRY THE NEXT ONE� would be printed. Only one try is given to find the answer and then the next problem appears.
Line 84 �PRINT� with nothing after it will allow for a blank space in the results. I used it so the results would be easier to read.

MULTIPLICATION PROGRAMS

program 1

10 REM TO FIND THE SQUARE OF A NUMBER 20 PRINT �WHAT NUMBER DO YOU WANT TO SQUARE?�
30 INPUT R
40 LET S = R * R
50 PRINT R,S
60 GO TO 20
70 END
Results:
WHAT NUMBER DO YOU WANT TO SQUARE?

636

Explanation�program 1.

Line 30 The student can type in any number that they want to be squared. They don�t have to know the answer.

program 2

10 REM STUDENT INPUTS MULT FACTS AND ANSWERS 15 PRINT � TYPE IN TWO MULT FACTS SEPARATED BY COMMAS�
20 INPUT A,B
30 LET C = A * B
40 PRINT �WHAT IS THE PRODUCT?�
50 INPUT C1
60 IF C1 = C THEN 90
70 PRINT �TRY AGAIN�
75 PRINT �YOUR NUMBERS ARE�;
76 PRINT A;B
8O GO TO 40
90 PRINT �VERY GOOD�
100 GO TO 15
110 END
Results:
TYPE IN TWO MULT FACTS SEPARATED BY COMMAS
3,5
WHAT IS THE PRODUCT?
14
TRY AGAIN

YOUR NUMBERS ARE 35
15 VERY GOOD

Explanation�program 2

Line 20 The student types in both the multiplication facts and 50 the answer.
Line 30 This line could easily be changed to test addition or any other skill.
Line 60 If the answer is incorrect the student gets to try again until the correct answer is given. Each time he tries the numbers are given to him again in case they are not remembered. If the answer is correct he can precede to the next problem of his choice.
Line 75 A semicolon at the end of a statement will cause the next �PRINT� statement to appear on the same line.

DIVISION PROGRAMS

program 1

100 REM DIVISION 200 PRINT �DIVIDEND�, �DIVISOR�, �QUOTIENT�
300 PRINT
400 READ A,B
500 IF A = 99 THEN 1000
550 LET C = A/B
600 PRINT A,B,C
700 GO TO 400
800 DATA 6,3,12,4,25,5,16,8
900 DATA 63,9,36,6,30,5,8,2
999 DATA 99,99
1000 END
Results:


DIVIDENDDIVISORQUOTIENT
632

Explanation�program 1

Line 200 Teaches the student what the terms in division are called. The column print out also helps to define them.
Line 500 When A is being read in the data statement as 99 the program will automatically end.

program 2

10 REM FIND THE MILES PER GALLON 20 PRINT �TYPE IN MILES AND GALLONS�
30 INPUT M,G
40 IF M = 99 THEN 90
50 LET P = M/G
60 PRINT �MILES=�; M; �GALLONS=�; G
70 PRINT �MPG=�; P
80 GO TO 30
90 END
Results:
TYPE IN MILES AND GALLONS

MILES = 60
GALLONS = 2
MFG = 30

Explanation�program 2

Line 60 A �PRINT� statement with the equal sign after it allows for the variable to have a label. I used a semicolon to keep the spacing close together.
Line 70 I used another �PRINT� statement so the answer to the formula would show below the numbers

Tuesday 17 February 2015

Yoruba Hymns Collection

Here are a few common hymns from the IOM (Iwe Orin Mimo). 
I searched everywhere on the Internet for these hymns and found very few, close to nothing, and so, I decided to find a way around it. 
I will add more with time and maybe some hymns from the English hymn books as well. 
Enjoy your devotion.