SlideShare a Scribd company logo
Step-1:Code the playing card and then sort the cards in a deck.
Step-2:Code the deck of cards then take a card from the deck.
Step-3:use the deck of cards and then rank distribution of cards.
PROGRAM IN VB.NET
Public Class Form1
02
Dim TheDeck As DeckOfCards
03
Dim Hands(NumberOfHands - 1) As HandOfCards
04
Const NumberOfHands As Integer = 10
05
06
07
Private Sub Form1_Paint(ByVal sender As Object, ByVal e
AsSystem.Windows.Forms.PaintEventArgs) Handles Me.Paint
08
If TheDeck IsNot Nothing Then
09
For i = 0 To NumberOfHands - 1
10
Hands(i).DrawHand(e.Graphics, 25, 25 + i * 65)
11
Next
12
End If
13
14
15
End Sub
16
17
18
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)Handles Button1.Click
19
Console.WriteLine("--------")
20
21
22
TheDeck = New DeckOfCards
23
TheDeck.ShuffleCards()
24
TheDeck.ShuffleCards()
25
'TheDeck.ShuffleCards()
26
' TheDeck.ShuffleCards()
27
For i = 0 To NumberOfHands - 1
28
Hands(i) = New HandOfCards
29
For c As Integer = 0 To 4
30
Hands(i).AddCard(TheDeck.TakeCard)
31
Next
32
Hands(i).SortHand()
33
Next
34
Array.Sort(Hands, New HandOfCards.HandComparer)
35
For i = 0 To NumberOfHands - 1
36
Console.WriteLine("{0}" & vbTab & "[{1}] = {2}" & vbTab & " {3}" & vbTab &
"[{4}]" & vbTab & " ({5})", i + 1, Hands(i).ToString, Hands(i).SuitValueOfHand,
Hands(i).RankDistrubtion, Hands(i).NameOfHand, Hands(i).ValueOfHand)
37
Next
38
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
39
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
40
'TheDeck.ShuffleCards()
41
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
42
Me.Refresh()
43
End Sub
44
End Class
Public Class Form1
Solution
Step-1:Code the playing card and then sort the cards in a deck.
Step-2:Code the deck of cards then take a card from the deck.
Step-3:use the deck of cards and then rank distribution of cards.
PROGRAM IN VB.NET
Public Class Form1
02
Dim TheDeck As DeckOfCards
03
Dim Hands(NumberOfHands - 1) As HandOfCards
04
Const NumberOfHands As Integer = 10
05
06
07
Private Sub Form1_Paint(ByVal sender As Object, ByVal e
AsSystem.Windows.Forms.PaintEventArgs) Handles Me.Paint
08
If TheDeck IsNot Nothing Then
09
For i = 0 To NumberOfHands - 1
10
Hands(i).DrawHand(e.Graphics, 25, 25 + i * 65)
11
Next
12
End If
13
14
15
End Sub
16
17
18
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)Handles Button1.Click
19
Console.WriteLine("--------")
20
21
22
TheDeck = New DeckOfCards
23
TheDeck.ShuffleCards()
24
TheDeck.ShuffleCards()
25
'TheDeck.ShuffleCards()
26
' TheDeck.ShuffleCards()
27
For i = 0 To NumberOfHands - 1
28
Hands(i) = New HandOfCards
29
For c As Integer = 0 To 4
30
Hands(i).AddCard(TheDeck.TakeCard)
31
Next
32
Hands(i).SortHand()
33
Next
34
Array.Sort(Hands, New HandOfCards.HandComparer)
35
For i = 0 To NumberOfHands - 1
36
Console.WriteLine("{0}" & vbTab & "[{1}] = {2}" & vbTab & " {3}" & vbTab &
"[{4}]" & vbTab & " ({5})", i + 1, Hands(i).ToString, Hands(i).SuitValueOfHand,
Hands(i).RankDistrubtion, Hands(i).NameOfHand, Hands(i).ValueOfHand)
37
Next
38
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
39
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
40
'TheDeck.ShuffleCards()
41
'Console.WriteLine("Deck [{0}]", TheDeck.DeckState)
42
Me.Refresh()
43
End Sub
44
End Class
Public Class Form1

More Related Content

More from info235816

1) Sugar because Payments to Labour has major component in Expenses .pdf
1) Sugar because Payments to Labour has major component in Expenses .pdf1) Sugar because Payments to Labour has major component in Expenses .pdf
1) Sugar because Payments to Labour has major component in Expenses .pdf
info235816
 
(3)Solution(3).pdf
(3)Solution(3).pdf(3)Solution(3).pdf
(3)Solution(3).pdf
info235816
 
Yellow fever is caused by the yellow fever virus and is spread by th.pdf
Yellow fever is caused by the yellow fever virus and is spread by th.pdfYellow fever is caused by the yellow fever virus and is spread by th.pdf
Yellow fever is caused by the yellow fever virus and is spread by th.pdf
info235816
 
Values are so important in life. The values kids learn at a young ag.pdf
Values are so important in life. The values kids learn at a young ag.pdfValues are so important in life. The values kids learn at a young ag.pdf
Values are so important in life. The values kids learn at a young ag.pdf
info235816
 
Time Value of Money (TVM) Value of the money does not remain same i.pdf
Time Value of Money (TVM) Value of the money does not remain same i.pdfTime Value of Money (TVM) Value of the money does not remain same i.pdf
Time Value of Money (TVM) Value of the money does not remain same i.pdf
info235816
 
#include stdio.h #include stdlib.h int main() { int l1.pdf
#include stdio.h #include stdlib.h int main() { int l1.pdf#include stdio.h #include stdlib.h int main() { int l1.pdf
#include stdio.h #include stdlib.h int main() { int l1.pdf
info235816
 
no it does not exists .pdf
                     no it does not exists                            .pdf                     no it does not exists                            .pdf
no it does not exists .pdf
info235816
 
The shape is angular, because of the two pairs of.pdf
                     The shape is angular, because of the two pairs of.pdf                     The shape is angular, because of the two pairs of.pdf
The shape is angular, because of the two pairs of.pdf
info235816
 
Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
                     Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf                     Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
info235816
 
so that the reaction takes place and forms (=0 )b.pdf
                     so that the reaction takes place and forms (=0 )b.pdf                     so that the reaction takes place and forms (=0 )b.pdf
so that the reaction takes place and forms (=0 )b.pdf
info235816
 
PV = nRT in both cases other one is taken consta.pdf
                     PV = nRT  in both cases other one is taken consta.pdf                     PV = nRT  in both cases other one is taken consta.pdf
PV = nRT in both cases other one is taken consta.pdf
info235816
 
In case of SO2 Dipole - Dipole forces are stron.pdf
                     In case of SO2  Dipole - Dipole forces are stron.pdf                     In case of SO2  Dipole - Dipole forces are stron.pdf
In case of SO2 Dipole - Dipole forces are stron.pdf
info235816
 
D) None of the above. first nitration takes place.pdf
                     D) None of the above. first nitration takes place.pdf                     D) None of the above. first nitration takes place.pdf
D) None of the above. first nitration takes place.pdf
info235816
 
Decrease in Entropy (S) always occurs when the ph.pdf
                     Decrease in Entropy (S) always occurs when the ph.pdf                     Decrease in Entropy (S) always occurs when the ph.pdf
Decrease in Entropy (S) always occurs when the ph.pdf
info235816
 
The diploid genetic system is more intersting than th monoploid gene.pdf
The diploid genetic system is more intersting than th monoploid gene.pdfThe diploid genetic system is more intersting than th monoploid gene.pdf
The diploid genetic system is more intersting than th monoploid gene.pdf
info235816
 
Solution If r t= Multiply both the sides by -1 , we have= -.pdf
Solution  If r t= Multiply both the sides by -1 , we have= -.pdfSolution  If r t= Multiply both the sides by -1 , we have= -.pdf
Solution If r t= Multiply both the sides by -1 , we have= -.pdf
info235816
 
conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
                     conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf                     conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
info235816
 
Reactivity of the metal Tendency to formcation                   .pdf
Reactivity of the metal  Tendency to formcation                   .pdfReactivity of the metal  Tendency to formcation                   .pdf
Reactivity of the metal Tendency to formcation                   .pdf
info235816
 
Purple sulfur bacteria use H2S as a source of electrons and protons.pdf
Purple sulfur bacteria use H2S as a source of electrons and protons.pdfPurple sulfur bacteria use H2S as a source of electrons and protons.pdf
Purple sulfur bacteria use H2S as a source of electrons and protons.pdf
info235816
 
Chemical reaction tkes place Zn + CuSO4 = ZnS04.pdf
                     Chemical reaction tkes place   Zn + CuSO4 = ZnS04.pdf                     Chemical reaction tkes place   Zn + CuSO4 = ZnS04.pdf
Chemical reaction tkes place Zn + CuSO4 = ZnS04.pdf
info235816
 

More from info235816 (20)

1) Sugar because Payments to Labour has major component in Expenses .pdf
1) Sugar because Payments to Labour has major component in Expenses .pdf1) Sugar because Payments to Labour has major component in Expenses .pdf
1) Sugar because Payments to Labour has major component in Expenses .pdf
 
(3)Solution(3).pdf
(3)Solution(3).pdf(3)Solution(3).pdf
(3)Solution(3).pdf
 
Yellow fever is caused by the yellow fever virus and is spread by th.pdf
Yellow fever is caused by the yellow fever virus and is spread by th.pdfYellow fever is caused by the yellow fever virus and is spread by th.pdf
Yellow fever is caused by the yellow fever virus and is spread by th.pdf
 
Values are so important in life. The values kids learn at a young ag.pdf
Values are so important in life. The values kids learn at a young ag.pdfValues are so important in life. The values kids learn at a young ag.pdf
Values are so important in life. The values kids learn at a young ag.pdf
 
Time Value of Money (TVM) Value of the money does not remain same i.pdf
Time Value of Money (TVM) Value of the money does not remain same i.pdfTime Value of Money (TVM) Value of the money does not remain same i.pdf
Time Value of Money (TVM) Value of the money does not remain same i.pdf
 
#include stdio.h #include stdlib.h int main() { int l1.pdf
#include stdio.h #include stdlib.h int main() { int l1.pdf#include stdio.h #include stdlib.h int main() { int l1.pdf
#include stdio.h #include stdlib.h int main() { int l1.pdf
 
no it does not exists .pdf
                     no it does not exists                            .pdf                     no it does not exists                            .pdf
no it does not exists .pdf
 
The shape is angular, because of the two pairs of.pdf
                     The shape is angular, because of the two pairs of.pdf                     The shape is angular, because of the two pairs of.pdf
The shape is angular, because of the two pairs of.pdf
 
Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
                     Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf                     Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
Step1 Moles of ions from NaCl = 2x.46 = .92 Step2.pdf
 
so that the reaction takes place and forms (=0 )b.pdf
                     so that the reaction takes place and forms (=0 )b.pdf                     so that the reaction takes place and forms (=0 )b.pdf
so that the reaction takes place and forms (=0 )b.pdf
 
PV = nRT in both cases other one is taken consta.pdf
                     PV = nRT  in both cases other one is taken consta.pdf                     PV = nRT  in both cases other one is taken consta.pdf
PV = nRT in both cases other one is taken consta.pdf
 
In case of SO2 Dipole - Dipole forces are stron.pdf
                     In case of SO2  Dipole - Dipole forces are stron.pdf                     In case of SO2  Dipole - Dipole forces are stron.pdf
In case of SO2 Dipole - Dipole forces are stron.pdf
 
D) None of the above. first nitration takes place.pdf
                     D) None of the above. first nitration takes place.pdf                     D) None of the above. first nitration takes place.pdf
D) None of the above. first nitration takes place.pdf
 
Decrease in Entropy (S) always occurs when the ph.pdf
                     Decrease in Entropy (S) always occurs when the ph.pdf                     Decrease in Entropy (S) always occurs when the ph.pdf
Decrease in Entropy (S) always occurs when the ph.pdf
 
The diploid genetic system is more intersting than th monoploid gene.pdf
The diploid genetic system is more intersting than th monoploid gene.pdfThe diploid genetic system is more intersting than th monoploid gene.pdf
The diploid genetic system is more intersting than th monoploid gene.pdf
 
Solution If r t= Multiply both the sides by -1 , we have= -.pdf
Solution  If r t= Multiply both the sides by -1 , we have= -.pdfSolution  If r t= Multiply both the sides by -1 , we have= -.pdf
Solution If r t= Multiply both the sides by -1 , we have= -.pdf
 
conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
                     conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf                     conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
conc . of H+ = conc. of H3O + = 0.250.17 =0.0425.pdf
 
Reactivity of the metal Tendency to formcation                   .pdf
Reactivity of the metal  Tendency to formcation                   .pdfReactivity of the metal  Tendency to formcation                   .pdf
Reactivity of the metal Tendency to formcation                   .pdf
 
Purple sulfur bacteria use H2S as a source of electrons and protons.pdf
Purple sulfur bacteria use H2S as a source of electrons and protons.pdfPurple sulfur bacteria use H2S as a source of electrons and protons.pdf
Purple sulfur bacteria use H2S as a source of electrons and protons.pdf
 
Chemical reaction tkes place Zn + CuSO4 = ZnS04.pdf
                     Chemical reaction tkes place   Zn + CuSO4 = ZnS04.pdf                     Chemical reaction tkes place   Zn + CuSO4 = ZnS04.pdf
Chemical reaction tkes place Zn + CuSO4 = ZnS04.pdf
 

Recently uploaded

JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 

Recently uploaded (20)

JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 

Step-1Code the playing card and then sort the cards in a deck.Ste.pdf

  • 1. Step-1:Code the playing card and then sort the cards in a deck. Step-2:Code the deck of cards then take a card from the deck. Step-3:use the deck of cards and then rank distribution of cards. PROGRAM IN VB.NET Public Class Form1 02 Dim TheDeck As DeckOfCards 03 Dim Hands(NumberOfHands - 1) As HandOfCards 04 Const NumberOfHands As Integer = 10 05 06 07 Private Sub Form1_Paint(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.PaintEventArgs) Handles Me.Paint 08 If TheDeck IsNot Nothing Then 09 For i = 0 To NumberOfHands - 1 10 Hands(i).DrawHand(e.Graphics, 25, 25 + i * 65) 11 Next 12 End If 13 14 15 End Sub 16 17 18 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
  • 2. System.EventArgs)Handles Button1.Click 19 Console.WriteLine("--------") 20 21 22 TheDeck = New DeckOfCards 23 TheDeck.ShuffleCards() 24 TheDeck.ShuffleCards() 25 'TheDeck.ShuffleCards() 26 ' TheDeck.ShuffleCards() 27 For i = 0 To NumberOfHands - 1 28 Hands(i) = New HandOfCards 29 For c As Integer = 0 To 4 30 Hands(i).AddCard(TheDeck.TakeCard) 31 Next 32 Hands(i).SortHand() 33 Next 34 Array.Sort(Hands, New HandOfCards.HandComparer) 35 For i = 0 To NumberOfHands - 1 36 Console.WriteLine("{0}" & vbTab & "[{1}] = {2}" & vbTab & " {3}" & vbTab & "[{4}]" & vbTab & " ({5})", i + 1, Hands(i).ToString, Hands(i).SuitValueOfHand,
  • 3. Hands(i).RankDistrubtion, Hands(i).NameOfHand, Hands(i).ValueOfHand) 37 Next 38 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 39 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 40 'TheDeck.ShuffleCards() 41 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 42 Me.Refresh() 43 End Sub 44 End Class Public Class Form1 Solution Step-1:Code the playing card and then sort the cards in a deck. Step-2:Code the deck of cards then take a card from the deck. Step-3:use the deck of cards and then rank distribution of cards. PROGRAM IN VB.NET Public Class Form1 02 Dim TheDeck As DeckOfCards 03 Dim Hands(NumberOfHands - 1) As HandOfCards 04 Const NumberOfHands As Integer = 10 05 06 07
  • 4. Private Sub Form1_Paint(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.PaintEventArgs) Handles Me.Paint 08 If TheDeck IsNot Nothing Then 09 For i = 0 To NumberOfHands - 1 10 Hands(i).DrawHand(e.Graphics, 25, 25 + i * 65) 11 Next 12 End If 13 14 15 End Sub 16 17 18 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click 19 Console.WriteLine("--------") 20 21 22 TheDeck = New DeckOfCards 23 TheDeck.ShuffleCards() 24 TheDeck.ShuffleCards() 25 'TheDeck.ShuffleCards() 26 ' TheDeck.ShuffleCards() 27
  • 5. For i = 0 To NumberOfHands - 1 28 Hands(i) = New HandOfCards 29 For c As Integer = 0 To 4 30 Hands(i).AddCard(TheDeck.TakeCard) 31 Next 32 Hands(i).SortHand() 33 Next 34 Array.Sort(Hands, New HandOfCards.HandComparer) 35 For i = 0 To NumberOfHands - 1 36 Console.WriteLine("{0}" & vbTab & "[{1}] = {2}" & vbTab & " {3}" & vbTab & "[{4}]" & vbTab & " ({5})", i + 1, Hands(i).ToString, Hands(i).SuitValueOfHand, Hands(i).RankDistrubtion, Hands(i).NameOfHand, Hands(i).ValueOfHand) 37 Next 38 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 39 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 40 'TheDeck.ShuffleCards() 41 'Console.WriteLine("Deck [{0}]", TheDeck.DeckState) 42 Me.Refresh() 43 End Sub 44