Sunday, March 20, 2011

Iteration statement

Iteration - Iteration also known as "Loop" is used for executing the same codes repeatedly. "Iteration Statements" are of many type, like entry control, exit control loop, etc. In this program it shows us the ascending values starting form 1 to 10.








Monday, March 14, 2011

Structured Programming

Selection:
- its is a program which uses statements, commonly used are If, Then, Else, that can be used to make a a program work. In my program i used If, then and, else statement that if you choose a number ranging from 1 to 10 then it will show the corresponding output.




Sequence:
- it is composed of listed instructions that enables it to run consecutively. In my program you must input 2 numbers, then click the command button to sum up the given numbers.



Private Sub Command1_Click()
‘To add the values in text box 1 and text box 2
Sum = Val(Text1.Text) + Val(Text2.Text)
‘To display the answer on label 1
Label1.Caption = Sum
End Sub 

Wednesday, March 2, 2011

Programming Practices

* Programming Readability
-use meaningful identifiers:
     txtNumber, lblResult
-Logic Structure:
- in my program i used the
     *If,Then,Else Statement:

     If txtNumber.Text = 9 Then
     lblResult.Caption = "Enemy!"
     Else
     If txtNumber.Text = 10 Then
     lblResult.Caption = "Forever!"
     end if

-Coding Practice:
     Private Sub cmdPredict_Click()
     If txtNumber.Text = 1 Then
     lblResult.Caption = "BestFriend!"
     Else
     If txtNumber.Text = 2 Then
     lblResult.Caption = "Special Friend!"
     end if
-Notes and Comments
     in this program it doesn't have a Comment on its code.

*Program Documentation 
-Program Listing
      I used txtNumber for my text box where you will input a number.
      I used lblResult for my label box where the results would  be shown.
      I used cmdPredict for my command button that would serve the switch to activate or run the program.

-Program Specification
     for this program I used Visual Basic 6.0, and this program shows the prediction on which number you have chosen.

-File Layouts and Record Description
-none

-Operating Instructions 
     My program uses a text box where you would choose a number ranging from 1 up to 10, then a label box that shows the prediction on your chosen number.