Shahezad Contractor
Professor Ebrahimi

CHAPTER 3
LOOP: DOING IT OVER AND OVER

LOOP AS A LABOR FORCE

One of the strengths of the computer is its ability to repeat a process over and over without getting tired or threatening to strike.  The program that you have written to perform a single task can now be repeated to perform the same task as many times as you wish.  This process of going over and over is known as repetition and is called a loop.  Can you think of a loop?  Of course! Our everyday activities, including getting up, eating working, studying, and sleeping are examples of a loop.  Can you identify other loops?  With a little thought, I know  you can.

 

TODAY'S PROGRAM

'Variables are declared here
Dim employeeid, hoursworked, numberofemployees As Integer
Dim hourlyrate, grosspay As Single

numberofemployees = 0

while numberofemployees < 5
 

'Values for the variables are entered here
employeeid = InputBox("ENTER THE EMPLOYEE ID: ")
hoursworked = InputBox("ENTER THE HOURS WORKED: ")
hourlyrate = InputBox("ENTER THE HOURLY RATE: ")

'Gross pay is calculated here
grosspay = hoursworked * hourlyrate

'Display gross pay here
MsgBox("YOUR GROSS PAY IS :" & grosspay)

numberofemployees = numberofemployees + 1

end while

 

Page 60 in the book
Save files in the H: Drive.

In order to loop we will use the word while.

Common Errors: People type INTERGER accidentaly.

Akibu, Hakeem O. +1
Alagheband, Shadi Crystal  
Colon, Christen N.  
Contractor, Shahezad M. Super Captain
Francoeur, Ralph J.  
Ghazanchyan, Farideh  
Guo, Sunli +1
Halajian, Alishan A.  
Hicks, Rory  
Nemati, Matthew +1
Paul, My-Kerline +2
Saeed, Amna  
Saeed, Asma +2