Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Option Explicit

Dim D As Single

Sub grading_tomat1()

'Penggunaan IF-THEN

D = InputBox("Masukan ukuran diameter tomat (mm)")

If D >= 100 Then

MsgBox "Tomat termasuk kedalam kelas A", vbInformation, "Hasil Grading"

ElseIf D >= 75 And D < 100 Then

MsgBox "Tomat termasuk kedalam kelas B", vbInformation, "Hasil Grading"

ElseIf D >= 50 And D < 75 Then

MsgBox "Tomat termasuk kedalam kelas C", vbInformation, "Hasil Grading"

ElseIf D < 50 Then

MsgBox "Tomat termasuk kedalam kelas D", vbInformation, "Hasil Grading"

End If

End Sub

Sub Grading_tomat2()

'Penggunaan Select Case

D = InputBox("Masukkan ukuran diameter tomat (mm)")

Select Case D

Case Is >= 100

MsgBox "nilai A", vbInformation, "Hasil Grading"

Case Is >= 75

MsgBox "nilai B", vbInformation, "Hasil Grading"

Case Is >= 50

MsgBox "nilai C", vbInformation, "Hasil Grading"

Case Is < 50

MsgBox "nilai D", vbInformation, "Hasil Grading"


End Select

End Sub

You might also like