Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help writing a program in C# to record winning hands and have it to deal out chips to player profiles after the

Hi, I need help writing a program in C# to record winning hands and have it to deal out chips to player profiles after the final round. I also need help with creating a function to list the types of winning hands and how often they occured. I've been stuck on these for a while now and this is my only option. Any help is grateful. Thank you!

this is my code

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

GAME.CS////////////////

using System;

using System.Collections.Generic;

namespace Poker_Tournament_App

{

class Game

{

int Id{get; set;}

string WinningHand{get; set;}

bool FinalRoundGame{get; set;}

List players = new List();

public Game()

{

Id = 404;

WinningHand = "";

FinalRoundGame = false;

}

//Initialize without players

public Game(int inId, string inWinningHand, bool inFinalRoundGame)

{

Id = inId;

WinningHand = inWinningHand;

FinalRoundGame = inFinalRoundGame;

}

//Initialize with player(s)

public Game(int inId, string inWinningHand, bool inFinalRoundGame, List inPlayers)

{

Id = inId;

WinningHand = inWinningHand;

FinalRoundGame = inFinalRoundGame;

addPlayers(inPlayers);

}

public void addPlayers(List inPlayers)

{

players.AddRange(inPlayers);

}

}

}

END///////////

PLAYER.CS///////////////

using System;

using System.Collections.Generic;

namespace Poker_Tournament_App

{

class Player

{

public string name {get; set;}

public DateTime dateJoined {get; set;} /ew DateTime(year, month, day)

public DateTime birthday {get; set;} /ew DateTime(year, month, day)

public string hometown {get; set;}

public int rankChips {get; set;} /ew DateTime(year, month, day)

Dictionary winningHandCount = new Dictionary();

public Player()

{

name = "";

dateJoined = new DateTime(1900, 01, 01);

birthday = new DateTime(1900, 01, 01);

hometown = "";

rankChips = 0;

}

public Player(string inName, DateTime inDateJoined, DateTime inBirthday, string inHometown, int inRankChips)

{

name = inName;

dateJoined = inDateJoined;

birthday = inBirthday;

hometown = inHometown;

rankChips = inRankChips;

}

public void updateWinningHandCount(string inHandType)

{

if(winningHandCount.ContainsKey(inHandType))

{

winningHandCount[inHandType] = winningHandCount[inHandType] + 1;

}

else

{

winningHandCount.Add(inHandType, 1);

}

}

}

}

END///////////////////////

PROGRAM.CS/////////////

using System;

namespace Poker_Tournament_App

{

class Program

{

public static void Main (string[] args) {

string selection;

Console.WriteLine("Select an option: ");

Console.WriteLine("1: Tournaments");

Console.WriteLine("2: Players");

Console.WriteLine("3: Overall Stats");

Console.WriteLine("4: Save & Quit");

selection = Console.ReadLine();

if (selection == "1")

{

Console.WriteLine("Tournaments.");

}

else if(selection == "2")

{

Console.WriteLine("Players.");

}

else if(selection == "3")

{

Console.WriteLine("Overall Stats.");

}

else if(selection == "4")

{

Console.WriteLine("Byeeeeeeeeeeeeeee");

}

}

}

}

END/////////////////

TOURNAMENT.CS/////////////

using System;

namespace Poker_Tournament_App

{

class Tournament

{

public string Name{get; set;}

public string Location{get; set;}

public int MaxPlayers{get; set;}

DateTime _tournamentDate;

public DateTime TournamentDate

{

get

{

return this._tournamentDate;

}

set

{

this._tournamentDate = value.Date;

}

}

public Tournament()

{

Name = "";

TournamentDate = new DateTime(1900, 01, 01);

Location = "";

MaxPlayers = 0;

}

public Tournament(string inName, DateTime inDate, string inLocation, int inMaxPlayers)

{

Name = inName;

TournamentDate = inDate;

Location = inLocation;

MaxPlayers = inMaxPlayers;

}

public override string ToString()

{

string printString = "";

printString += " Name:\t\t" + Name;

printString += " Date:\t\t" + TournamentDate.ToString("d");

printString += " Location:\t" + Location;

printString += " Max Players:" + MaxPlayers;

return printString;

}

}

}

END///////////////////

File Edit Selection View Go Run Terminal Help EXPLORER Game.cs x Game.cs > { } Poker Tournament_App > Poker_Tournament App.Game > Id using System; using System.Collections.Generic; 10 11 12 13 14 15 namespace Poker Tournament App { OPEN EDITORS X Game.cs POKER-TOURNAMENT-APP V .vscode () launch.json [] tasks.json > bin > obj .gitignore banana.txt Game.cs Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs 16 17 O references class Game 18 3 references int Id{get; set:) 3 references string WinningHand(get; set;} 3 references bool Final Round Game{get; set;} 19 20 21 1 reference List(); 22 23 O references public Game) 24 25 26 27 28 29 30 31 Id = 464; WinningHand = ""; FinalRoundGame = false; } 32 33 34 35 36 37 38 39 //Initialize without players O references public Game (int inid, string inWinningHand, bool inFinal Round Game) { Id = inid; WinningHand - inWinningHand; FinalRoundGame = inFinalRoundGame; 40 41 42 43 44 45 46 47 //Initialize with player(s) O references public Game(int inid, string inWinningHand, bool inFinal RoundGame, List inPlayers) { Id = inid; WinningHand = inWinningHand; FinalRoundGame = inFinalRoundGame; addPlayers(inPlayers); 1 reference public void addPlayers(List inPlayers) { players.AddRange(inPlayers); 48 49 50 51 52 53 54 55 } 203 > OUTLINE > TIMELINE EXPLORER Player.cs x Player.cs ... 1 using System; ing System.Collections.Generic; 4 namespace Poker Tournament App { 6 7 class Player { OPEN EDITORS x Player.cs V POKER-TOURNAMENT-APP vscode launch.json 1) tasks.json > bin > ob] gitignore banana.txt Game.cs Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs 8 public string name {get; set;} 9 public DateTime dateJoined (get; set;} /ew DateTime (year, month, day) 10 public DateTime birthday {get; set;} /ew DateTime (year, month, day) 11 public string hometown {get; set;} public int rankChips (get; set;} /ew DateTime (year, month, day) 12 13 14 15 Dictionary winningHandCount = new Dictionary(); 16 17 18 19 20 21 public Player() { name = ""; dateJoined = new DateTime (1900, 01, 01); birthday new DateTime (1900, 01, 01); hometown = ""; rankChips = 0; 23 24 25 26 27 28 public Player(string inName, DateTime inDateJoined, DateTime inBirthday, string inHometown, int inRankChips) { name = inName; dateJoined = inDateJoined; birthday - inBirthday, hometown - inHometown; rankChips = inRankChips; } 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 public void updateWinning and Count(string inHandType) { if(winningHand Count.ContainsKey(inHandType) ) { winningHandCount[inHandType] = winningHandCount[inHandType] + 1; } else { winningHandCount.Add( inHandType, 1); } 3 303 > OUTLINE EXPLORER V OPEN EDITORS XC Program.cs POKER-TOURNAMENT-APP v.vscode () launch.json () tasks.json > bin > obi gitignore banana.txt Game.cs O Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs Program.cs x Program.cs > ... 1 using System; 2 . 3 namespace Poker_Tournament App 4 { O references 5 class Program 6 { O references 7 public static void Main(string[] args) { 8 string selection; 9 10 Console.WriteLine("Select an option: "); 11 Console.WriteLine("1: Tournaments"); 12 Console.WriteLine("2: Players"); 13 Console.WriteLine("3: Overall Stats"); 14 Console.WriteLine("4: Save & Quit"); 15 selection = Console.ReadLine(); 16 17 if (selection == "1") 18 { 19 Console.WriteLine("Tournaments."); 20 } 21 else if(selection == "2") 22 { 23 Console.WriteLine("Players."); 24 } 25 else if(selection => "3") 26 { 27 Console.WriteLine("Overall Stats."); 28 } else if(selection == "4") 30 { 31 Console.WriteLine("Byeeeeeeeeeeeeeee"); 32 } 33 34 35 36 > OUTLINE > TIMELINE Program.cs - Poker Tournament-App - Visual Studio Code 2 Tournament.cs - Poker-Tournament-App - Visual Studio Code File Edit Selection View Go Run Terminal Help y EXPLORER Tournament.cs x OPEN EDITORS Tournament.cs > ... Xo Tournament.cs 9 POKER-TOURNAMENT APP 10 using System; v vscode 11 12 namespace Poker Tournament App [] launch.json 13 { [] tasks.json O references > bin 14 class Tournament > obj 15 { .gitignore 3 references banana.txt 16 public string Name(get; set;} Game.cs 3 references 17 public string Location{get; set;} Player.cs 3 references m Poker League Sample Data 18 public int MaxPlayers{get; set;} Poker-Tournament-App.csproj 19 Program.cs 2 references README.md 20 DateTime tournament Date; 21 Tournament.cs 3 references 22 public DateTime TournamentDate 23 24 get 25 { 26 return this._tournamentDate; 27 } 28 set 29 30 this. tournament Date = value. Date; 31 } 32 33 O references 34 public Tournament 35 { 36 Name - **; 37 TournamentDate = new DateTime (1900, 01, 01); 38 Location = ""; 39 MaxPlayers - B; 40 41 O references 42 public Tournament(string inName, DateTime inDate, string inLocation, int inMaxPlayers) 43 { Name = inName; 45 TournamentDate = inDate; 46 Location = inLocation; 47 MaxPlayers - inMaxPlayers; 48 49 50 public override string ToString() 51 52 string printString = **; 53 printString += " Name:\t\t" + Name; 54 printString + " Date:\t\t" + TournamentDate.ToString("d"); 55 printString + " Location:\t" + Location; 56 printString + " Max Players:" + MaxPlayers; 57 return printString: 58 59 60 } 61 62 63 > OUTLINE > TIMELINE Tournament.cs - Poker-Tournament-App - Visual Studio Code P Poker Toumament-Ann Il Coll Spaces UTF- SIF C File Edit Selection View Go Run Terminal Help EXPLORER Game.cs x Game.cs > { } Poker Tournament_App > Poker_Tournament App.Game > Id using System; using System.Collections.Generic; 10 11 12 13 14 15 namespace Poker Tournament App { OPEN EDITORS X Game.cs POKER-TOURNAMENT-APP V .vscode () launch.json [] tasks.json > bin > obj .gitignore banana.txt Game.cs Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs 16 17 O references class Game 18 3 references int Id{get; set:) 3 references string WinningHand(get; set;} 3 references bool Final Round Game{get; set;} 19 20 21 1 reference List(); 22 23 O references public Game) 24 25 26 27 28 29 30 31 Id = 464; WinningHand = ""; FinalRoundGame = false; } 32 33 34 35 36 37 38 39 //Initialize without players O references public Game (int inid, string inWinningHand, bool inFinal Round Game) { Id = inid; WinningHand - inWinningHand; FinalRoundGame = inFinalRoundGame; 40 41 42 43 44 45 46 47 //Initialize with player(s) O references public Game(int inid, string inWinningHand, bool inFinal RoundGame, List inPlayers) { Id = inid; WinningHand = inWinningHand; FinalRoundGame = inFinalRoundGame; addPlayers(inPlayers); 1 reference public void addPlayers(List inPlayers) { players.AddRange(inPlayers); 48 49 50 51 52 53 54 55 } 203 > OUTLINE > TIMELINE EXPLORER Player.cs x Player.cs ... 1 using System; ing System.Collections.Generic; 4 namespace Poker Tournament App { 6 7 class Player { OPEN EDITORS x Player.cs V POKER-TOURNAMENT-APP vscode launch.json 1) tasks.json > bin > ob] gitignore banana.txt Game.cs Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs 8 public string name {get; set;} 9 public DateTime dateJoined (get; set;} /ew DateTime (year, month, day) 10 public DateTime birthday {get; set;} /ew DateTime (year, month, day) 11 public string hometown {get; set;} public int rankChips (get; set;} /ew DateTime (year, month, day) 12 13 14 15 Dictionary winningHandCount = new Dictionary(); 16 17 18 19 20 21 public Player() { name = ""; dateJoined = new DateTime (1900, 01, 01); birthday new DateTime (1900, 01, 01); hometown = ""; rankChips = 0; 23 24 25 26 27 28 public Player(string inName, DateTime inDateJoined, DateTime inBirthday, string inHometown, int inRankChips) { name = inName; dateJoined = inDateJoined; birthday - inBirthday, hometown - inHometown; rankChips = inRankChips; } 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 public void updateWinning and Count(string inHandType) { if(winningHand Count.ContainsKey(inHandType) ) { winningHandCount[inHandType] = winningHandCount[inHandType] + 1; } else { winningHandCount.Add( inHandType, 1); } 3 303 > OUTLINE EXPLORER V OPEN EDITORS XC Program.cs POKER-TOURNAMENT-APP v.vscode () launch.json () tasks.json > bin > obi gitignore banana.txt Game.cs O Player.cs Poker League Sample Data - ... Poker-Tournament-App.csproj Program.cs README.md Tournament.cs Program.cs x Program.cs > ... 1 using System; 2 . 3 namespace Poker_Tournament App 4 { O references 5 class Program 6 { O references 7 public static void Main(string[] args) { 8 string selection; 9 10 Console.WriteLine("Select an option: "); 11 Console.WriteLine("1: Tournaments"); 12 Console.WriteLine("2: Players"); 13 Console.WriteLine("3: Overall Stats"); 14 Console.WriteLine("4: Save & Quit"); 15 selection = Console.ReadLine(); 16 17 if (selection == "1") 18 { 19 Console.WriteLine("Tournaments."); 20 } 21 else if(selection == "2") 22 { 23 Console.WriteLine("Players."); 24 } 25 else if(selection => "3") 26 { 27 Console.WriteLine("Overall Stats."); 28 } else if(selection == "4") 30 { 31 Console.WriteLine("Byeeeeeeeeeeeeeee"); 32 } 33 34 35 36 > OUTLINE > TIMELINE Program.cs - Poker Tournament-App - Visual Studio Code 2 Tournament.cs - Poker-Tournament-App - Visual Studio Code File Edit Selection View Go Run Terminal Help y EXPLORER Tournament.cs x OPEN EDITORS Tournament.cs > ... Xo Tournament.cs 9 POKER-TOURNAMENT APP 10 using System; v vscode 11 12 namespace Poker Tournament App [] launch.json 13 { [] tasks.json O references > bin 14 class Tournament > obj 15 { .gitignore 3 references banana.txt 16 public string Name(get; set;} Game.cs 3 references 17 public string Location{get; set;} Player.cs 3 references m Poker League Sample Data 18 public int MaxPlayers{get; set;} Poker-Tournament-App.csproj 19 Program.cs 2 references README.md 20 DateTime tournament Date; 21 Tournament.cs 3 references 22 public DateTime TournamentDate 23 24 get 25 { 26 return this._tournamentDate; 27 } 28 set 29 30 this. tournament Date = value. Date; 31 } 32 33 O references 34 public Tournament 35 { 36 Name - **; 37 TournamentDate = new DateTime (1900, 01, 01); 38 Location = ""; 39 MaxPlayers - B; 40 41 O references 42 public Tournament(string inName, DateTime inDate, string inLocation, int inMaxPlayers) 43 { Name = inName; 45 TournamentDate = inDate; 46 Location = inLocation; 47 MaxPlayers - inMaxPlayers; 48 49 50 public override string ToString() 51 52 string printString = **; 53 printString += " Name:\t\t" + Name; 54 printString + " Date:\t\t" + TournamentDate.ToString("d"); 55 printString + " Location:\t" + Location; 56 printString + " Max Players:" + MaxPlayers; 57 return printString: 58 59 60 } 61 62 63 > OUTLINE > TIMELINE Tournament.cs - Poker-Tournament-App - Visual Studio Code P Poker Toumament-Ann Il Coll Spaces UTF- SIF C

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

Why does the fluorine atom tend to gain only one electron?

Answered: 1 week ago