SlideShare a Scribd company logo
1 of 2
Laboratory Activity 3 (Batch 3)

Roll Dice Program




Public Class Form1
    Private dice1 As Integer
    Private dice2 As Integer
    Private two, three, four, five, six, seven, eight, nine, ten,
eleven, twelve As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
        Dim objRN As Random = New Random

         dice1 = objRN.Next(1, 7)
         dice2 = objRN.Next(1, 7)

         Label1.Text = dice1
         Label3.Text = dice2

        CountDice(dice1, dice2)
    End Sub
    Sub CountDice(ByVal x As Integer, ByVal y As Integer)
        If (x + y) = 2 Then
            two = two + 1
ElseIf (x + y) = 3 Then
            three = three + 1
       ElseIf (x + y) = 4 Then
            four = four + 1
       ElseIf (x + y) = 5 Then
            five = five + 1
       ElseIf (x + y) = 6 Then
            six = six + 1
       ElseIf (x + y) = 7 Then
            seven = seven + 1
       ElseIf (x + y) = 8 Then
            eight = eight + 1
       ElseIf (x + y) = 9 Then
            nine = nine + 1
       ElseIf (x + y) = 10 Then
            ten = ten + 1
       ElseIf (x + y) = 11 Then
            eleven = eleven + 1
       Else
            twelve = twelve + 1

       End If
   End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        ListBox1.Items.Add("    Value       Count")
        ListBox1.Items.Add(" ----------        -----------")
        ListBox1.Items.Add(" ")
        ListBox1.Items.Add("       2              " & two)
        ListBox1.Items.Add("       3              " & three)
        ListBox1.Items.Add("       4              " & four)
        ListBox1.Items.Add("       5              " & five)
        ListBox1.Items.Add("       6              " & six)
        ListBox1.Items.Add("       7              " & seven)
        ListBox1.Items.Add("       8              " & eight)
        ListBox1.Items.Add("       9              " & nine)
        ListBox1.Items.Add("       10            " & ten)
        ListBox1.Items.Add("       11            " & eleven)
        ListBox1.Items.Add("       12            " & twelve)
    End Sub
End Class

More Related Content

Viewers also liked

J Aguiars Bio
J Aguiars BioJ Aguiars Bio
J Aguiars Biojtaguiar
 
Costa BBD Taller Conferencia Endeavor 2009
Costa BBD Taller Conferencia Endeavor 2009Costa BBD Taller Conferencia Endeavor 2009
Costa BBD Taller Conferencia Endeavor 2009enendeavor
 
Le programme d’assemblée locale sur le tourisme 2015
Le programme d’assemblée locale sur le tourisme 2015Le programme d’assemblée locale sur le tourisme 2015
Le programme d’assemblée locale sur le tourisme 2015Destination Canada
 
Guia DDJJ informativa cuatrimestral monotributo
Guia DDJJ informativa cuatrimestral monotributoGuia DDJJ informativa cuatrimestral monotributo
Guia DDJJ informativa cuatrimestral monotributoIgnacio Barrios
 
日本大学経済学部スライドWeb公開版
日本大学経済学部スライドWeb公開版日本大学経済学部スライドWeb公開版
日本大学経済学部スライドWeb公開版Tatsuya Nomoto
 
Kl piemeklēšanas vadlīnijas
Kl piemeklēšanas vadlīnijasKl piemeklēšanas vadlīnijas
Kl piemeklēšanas vadlīnijasIrina Kezik
 

Viewers also liked (9)

J Aguiars Bio
J Aguiars BioJ Aguiars Bio
J Aguiars Bio
 
Costa BBD Taller Conferencia Endeavor 2009
Costa BBD Taller Conferencia Endeavor 2009Costa BBD Taller Conferencia Endeavor 2009
Costa BBD Taller Conferencia Endeavor 2009
 
5-Cm11
5-Cm115-Cm11
5-Cm11
 
Le programme d’assemblée locale sur le tourisme 2015
Le programme d’assemblée locale sur le tourisme 2015Le programme d’assemblée locale sur le tourisme 2015
Le programme d’assemblée locale sur le tourisme 2015
 
Evaluate Your Content
Evaluate Your ContentEvaluate Your Content
Evaluate Your Content
 
Guia DDJJ informativa cuatrimestral monotributo
Guia DDJJ informativa cuatrimestral monotributoGuia DDJJ informativa cuatrimestral monotributo
Guia DDJJ informativa cuatrimestral monotributo
 
日本大学経済学部スライドWeb公開版
日本大学経済学部スライドWeb公開版日本大学経済学部スライドWeb公開版
日本大学経済学部スライドWeb公開版
 
Presentation jdll
Presentation jdllPresentation jdll
Presentation jdll
 
Kl piemeklēšanas vadlīnijas
Kl piemeklēšanas vadlīnijasKl piemeklēšanas vadlīnijas
Kl piemeklēšanas vadlīnijas
 

Similar to Laboratory activity 3 b3

High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scaladjspiewak
 
Reservasi hotel
Reservasi hotelReservasi hotel
Reservasi hoteldian pw
 
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 34 of 180
The Ring programming language version 1.5.1 book - Part 34 of 180The Ring programming language version 1.5.1 book - Part 34 of 180
The Ring programming language version 1.5.1 book - Part 34 of 180Mahmoud Samir Fayed
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala LanguageAshal aka JOKER
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge O T
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In RubyRoss Lawley
 
The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196Mahmoud Samir Fayed
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008atsumagaysay
 
7 Habits For a More Functional Swift
7 Habits For a More Functional Swift7 Habits For a More Functional Swift
7 Habits For a More Functional SwiftJason Larsen
 
Introduction to R
Introduction to RIntroduction to R
Introduction to Rvpletap
 
ゼロから始めるScala文法
ゼロから始めるScala文法ゼロから始めるScala文法
ゼロから始めるScala文法Ryuichi ITO
 
beginners_python_cheat_sheet_pcc_all (3).pptx
beginners_python_cheat_sheet_pcc_all (3).pptxbeginners_python_cheat_sheet_pcc_all (3).pptx
beginners_python_cheat_sheet_pcc_all (3).pptxHongAnhNguyn285885
 
The Ring programming language version 1.8 book - Part 41 of 202
The Ring programming language version 1.8 book - Part 41 of 202The Ring programming language version 1.8 book - Part 41 of 202
The Ring programming language version 1.8 book - Part 41 of 202Mahmoud Samir Fayed
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 

Similar to Laboratory activity 3 b3 (20)

High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
 
Reservasi hotel
Reservasi hotelReservasi hotel
Reservasi hotel
 
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189
 
The Ring programming language version 1.5.1 book - Part 34 of 180
The Ring programming language version 1.5.1 book - Part 34 of 180The Ring programming language version 1.5.1 book - Part 34 of 180
The Ring programming language version 1.5.1 book - Part 34 of 180
 
Punto fijo multivariante
Punto fijo multivariantePunto fijo multivariante
Punto fijo multivariante
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
 
Python cheatsheet for beginners
Python cheatsheet for beginnersPython cheatsheet for beginners
Python cheatsheet for beginners
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In Ruby
 
The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008
 
7 Habits For a More Functional Swift
7 Habits For a More Functional Swift7 Habits For a More Functional Swift
7 Habits For a More Functional Swift
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
ゼロから始めるScala文法
ゼロから始めるScala文法ゼロから始めるScala文法
ゼロから始めるScala文法
 
beginners_python_cheat_sheet_pcc_all (3).pptx
beginners_python_cheat_sheet_pcc_all (3).pptxbeginners_python_cheat_sheet_pcc_all (3).pptx
beginners_python_cheat_sheet_pcc_all (3).pptx
 
The Ring programming language version 1.8 book - Part 41 of 202
The Ring programming language version 1.8 book - Part 41 of 202The Ring programming language version 1.8 book - Part 41 of 202
The Ring programming language version 1.8 book - Part 41 of 202
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 

More from Jomel Penalba

SE - Software Requirements
SE - Software RequirementsSE - Software Requirements
SE - Software RequirementsJomel Penalba
 
Requirements Engineering Process
Requirements Engineering ProcessRequirements Engineering Process
Requirements Engineering ProcessJomel Penalba
 
Copy of business hardware
Copy of business hardwareCopy of business hardware
Copy of business hardwareJomel Penalba
 
Business functions and supply chains
Business functions and supply chainsBusiness functions and supply chains
Business functions and supply chainsJomel Penalba
 
Ch5 - Project Management
Ch5 - Project ManagementCh5 - Project Management
Ch5 - Project ManagementJomel Penalba
 
Laboratory activity 3 b2
Laboratory activity 3 b2Laboratory activity 3 b2
Laboratory activity 3 b2Jomel Penalba
 
Laboratory activity 3 b1
Laboratory activity 3 b1Laboratory activity 3 b1
Laboratory activity 3 b1Jomel Penalba
 
Software process models
Software process modelsSoftware process models
Software process modelsJomel Penalba
 
05 control structures 2
05 control structures 205 control structures 2
05 control structures 2Jomel Penalba
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1Jomel Penalba
 
03 intro to vb programming
03 intro to vb programming03 intro to vb programming
03 intro to vb programmingJomel Penalba
 
02 intro to vb-net ide
02 intro to vb-net ide02 intro to vb-net ide
02 intro to vb-net ideJomel Penalba
 
Soft Eng - Software Process
Soft  Eng - Software ProcessSoft  Eng - Software Process
Soft Eng - Software ProcessJomel Penalba
 

More from Jomel Penalba (20)

SE - System Models
SE - System ModelsSE - System Models
SE - System Models
 
SE - Software Requirements
SE - Software RequirementsSE - Software Requirements
SE - Software Requirements
 
Requirements Engineering Process
Requirements Engineering ProcessRequirements Engineering Process
Requirements Engineering Process
 
Copy of business hardware
Copy of business hardwareCopy of business hardware
Copy of business hardware
 
Business hardware
Business hardwareBusiness hardware
Business hardware
 
Crm
CrmCrm
Crm
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Business functions and supply chains
Business functions and supply chainsBusiness functions and supply chains
Business functions and supply chains
 
12 gui concepts 1
12 gui concepts 112 gui concepts 1
12 gui concepts 1
 
Ch5 - Project Management
Ch5 - Project ManagementCh5 - Project Management
Ch5 - Project Management
 
Laboratory activity 3 b2
Laboratory activity 3 b2Laboratory activity 3 b2
Laboratory activity 3 b2
 
Laboratory activity 3 b1
Laboratory activity 3 b1Laboratory activity 3 b1
Laboratory activity 3 b1
 
06 procedures
06 procedures06 procedures
06 procedures
 
Software process models
Software process modelsSoftware process models
Software process models
 
05 control structures 2
05 control structures 205 control structures 2
05 control structures 2
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
 
03 intro to vb programming
03 intro to vb programming03 intro to vb programming
03 intro to vb programming
 
02 intro to vb-net ide
02 intro to vb-net ide02 intro to vb-net ide
02 intro to vb-net ide
 
01 intro to vb-net
01 intro to vb-net01 intro to vb-net
01 intro to vb-net
 
Soft Eng - Software Process
Soft  Eng - Software ProcessSoft  Eng - Software Process
Soft Eng - Software Process
 

Laboratory activity 3 b3

  • 1. Laboratory Activity 3 (Batch 3) Roll Dice Program Public Class Form1 Private dice1 As Integer Private dice2 As Integer Private two, three, four, five, six, seven, eight, nine, ten, eleven, twelve As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objRN As Random = New Random dice1 = objRN.Next(1, 7) dice2 = objRN.Next(1, 7) Label1.Text = dice1 Label3.Text = dice2 CountDice(dice1, dice2) End Sub Sub CountDice(ByVal x As Integer, ByVal y As Integer) If (x + y) = 2 Then two = two + 1
  • 2. ElseIf (x + y) = 3 Then three = three + 1 ElseIf (x + y) = 4 Then four = four + 1 ElseIf (x + y) = 5 Then five = five + 1 ElseIf (x + y) = 6 Then six = six + 1 ElseIf (x + y) = 7 Then seven = seven + 1 ElseIf (x + y) = 8 Then eight = eight + 1 ElseIf (x + y) = 9 Then nine = nine + 1 ElseIf (x + y) = 10 Then ten = ten + 1 ElseIf (x + y) = 11 Then eleven = eleven + 1 Else twelve = twelve + 1 End If End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.Items.Clear() ListBox1.Items.Add(" Value Count") ListBox1.Items.Add(" ---------- -----------") ListBox1.Items.Add(" ") ListBox1.Items.Add(" 2 " & two) ListBox1.Items.Add(" 3 " & three) ListBox1.Items.Add(" 4 " & four) ListBox1.Items.Add(" 5 " & five) ListBox1.Items.Add(" 6 " & six) ListBox1.Items.Add(" 7 " & seven) ListBox1.Items.Add(" 8 " & eight) ListBox1.Items.Add(" 9 " & nine) ListBox1.Items.Add(" 10 " & ten) ListBox1.Items.Add(" 11 " & eleven) ListBox1.Items.Add(" 12 " & twelve) End Sub End Class