Submitted by: Submitted by lokileo
Views: 279
Words: 385
Pages: 2
Category: Science and Technology
Date Submitted: 11/02/2012 06:12 AM
Question one :
Private Sub Form_Activate()
Dim name As String
Dim mark As Integer
Dim grade As String
Dim i As Integer, n As Integer
Max = -1
n = 10
Print Spc(20); "EXAMINATION REPORT"
Print "No.", "Name", "Mark", "Grade"
For i = 1 To n
name = InputBox("Enter name:")
mark = InputBox("Enter mark:")
If mark >= 0 And mark <= 49 Then
grade = "F"
ElseIf mark >= 50 And mark <= 64 Then
grade = "C"
ElseIf mark >= 65 And mark <= 79 Then
grade = "B"
ElseIf mark >= 80 And mark <= 100 Then
grade = "A"
End If
Print i, name, mark, grade
total = total + mark
If mark > Max Then
Max = mark
End If
Next i
Print , "average mark" & Round(total / n, 2)
Print , "maximum" & Max
End Sub
Question two :
Private Sub Form_Activate()
Dim name As String
Dim hours As Integer
Dim salary As Integer
Dim rate As Double
Dim total As Double
Dim i As Integer, n As Integer
n=12
rate=7.5
Print Spc(20) " PAYROLL REPORT "
Print "No.","Employee Name","Hours","Salary(RM)"
For i= 1 to n
name = InputBox("Enter name:")
hour = InputBox("Enter hour:")
If hours >= 0 And hours <= 40 Then
salary = hours * rate
ElseIf hours > 40 And hours <= 60 Then
salary = 300 + (hours - 40) * rate * 1.5
ElseIf hours > 60 Then
salary = 525 + (hours - 60) * rate * 2
End If
total = total + salary
Print i, name, , hours, salary
Next i
Print "Total Salary = " & total
Question four :
Private Sub Form_Activate()
Dim area As Double
Dim circumference As Double
Dim radius As Double
n = 5
For i = 1 To n
r = InputBox("Enter Radius")
area = 3.1412 * r * r
circumference = 2 * 3.1412 * r
Print "Area = ", , Round(area, 2)
Print "Circumference = ", Round(circumference, 2)
Next i
End sub
Question five :
Private Sub Form_Activate()
Dim count As Integer
Dim name As String
Dim sex As String
Dim age As Integer
Dim tel As String
Dim email As String
Open "E:\VB6...