}//end solve method for player three public void setGame() { wheel player1 = new wheel(); wheel player2 = new wheel(); wheel player3 = new wheel(); int total; //set money amount when program loads total = player1.getTotalMoney(); //printing it back out from what was calculated txtPlayerOne.Text = "$" + total.ToString("n2"); //set money amount when program loads total = player2.getTotalMoney(); //printing it back out from what was calculated txtPlayerTwo.Text = "$" + total.ToString("n2"); //set money amount when program loads total = player3.getTotalMoney(); //printing it back out from what was calculated txtPlayerThree.Text = "$" + total.ToString("n2"); }//end void method
}//end btnExit Two button public void playerTwoMethod() { int p2Number = 0; int total = 0; //object used to go back to the main when program goes to default in the switch wheelOfFortune p2Main_Screen = new wheelOfFortune(); wheel playerTwo = new wheel(); //converting the input to a char char p2LetterValue = char.Parse(txtGuessTwo.Text); while (playerTwo.getSelectedLetter(p2LetterValue)) { if (playerTwo.getSelectedLetter(p2LetterValue)) { if (p2LetterValue == 'S') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtS.Text = "S"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); } else if (p2LetterValue == 'O') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtO.Text = "O"; p2Main_Screen.txt2ndO.Text = "O"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); total = playerTwo.calculateMoney(p2Number) * 2; total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); } else if (p2LetterValue == 'F') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtF.Text = "F"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'T') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtT.Text = "T"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'W') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtW.Text = "W"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'A') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtA.Text = "A"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'R') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtR.Text = "R"; p2Main_Screen.txt2ndR.Text = "R"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); total = playerTwo.calculateMoney(p2Number) * 2; total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'E') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtE.Text = "E"; p2Main_Screen.txt2ndE.Text = "E"; p2Main_Screen.txt3rdE.Text = "E"; p2Main_Screen.txt4rthE.Text = "E"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); total = playerTwo.calculateMoney(p2Number) * 4; total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'D') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtD.Text = "D"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'V') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtV.Text = "V"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'L') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtL.Text = "L"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (p2LetterValue == 'P') { MessageBox.Show("The letter " + p2LetterValue + " matches " + "\nSpin to guess another one!"); p2Main_Screen.txtP.Text = "P"; p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.Show(); }//end else if else if (!playerTwo.getSelectedLetter(p2LetterValue)) { MessageBox.Show("Sorry incorrect letter " + "\nNext players turn"); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.btnSpinPlayerOne.Hide(); p2Main_Screen.btnSolvePlayerOne.Hide(); p2Main_Screen.lblMessageOne.Hide(); p2Main_Screen.btnSpinPlayerTwo.Hide(); p2Main_Screen.btnSolvePlayerTwo.Hide(); p2Main_Screen.lblMessageTwo.Hide(); p2Main_Screen.btnSpinPlayerThree.Show(); p2Main_Screen.btnSolvePlayerThree.Show(); p2Main_Screen.lblMessageThree.Show(); p2Main_Screen.Show(); break; }//end else else { MessageBox.Show("PLEASE TYPE IN A VALID LETTER"); } //end else } //end if //bumps into this if the statement is not true else if (!playerTwo.getSelectedLetter(p2LetterValue)) { MessageBox.Show("Sorry incorrect letter " + "\nNext players turn"); this.Hide(); playerTwo.calculateMoney(p2Number); total = playerTwo.getTotalMoney(); p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2"); p2Main_Screen.Enabled = true; p2Main_Screen.btnSpinPlayerOne.Hide(); p2Main_Screen.btnSolvePlayerOne.Hide(); p2Main_Screen.lblMessageOne.Hide(); p2Main_Screen.btnSpinPlayerTwo.Hide(); p2Main_Screen.btnSolvePlayerTwo.Hide(); p2Main_Screen.lblMessageTwo.Hide(); p2Main_Screen.btnSpinPlayerThree.Show(); p2Main_Screen.btnSolvePlayerThree.Show(); p2Main_Screen.lblMessageThree.Show(); p2Main_Screen.Show(); }//end else if else { MessageBox.Show("PLEASE TYPE IN A VALID LETTER"); }//end else break; }//end while if (p2Main_Screen.txtS.Enabled && p2Main_Screen.txtO.Enabled && p2Main_Screen.txt2ndO.Enabled && p2Main_Screen.txtF.Enabled && p2Main_Screen.txtT.Enabled && p2Main_Screen.txtW.Enabled && p2Main_Screen.txtA.Enabled && p2Main_Screen.txtR.Enabled && p2Main_Screen.txt2ndR.Enabled && p2Main_Screen.txtE.Enabled && p2Main_Screen.txt2ndE.Enabled && p2Main_Screen.txt3rdE.Enabled && p2Main_Screen.txt4rthE.Enabled && p2Main_Screen.txtD.Enabled && p2Main_Screen.txtV.Enabled && p2Main_Screen.txtL.Enabled && p2Main_Screen.txtP.Enabled) { winner p2Winner = new winner(); MessageBox.Show("GOOD JOB"); //string message p2Winner.txtWinner.Text = "Player Two"; total = playerTwo.getTotalMoney(); p2Winner.txtTotalAmount.Text = "$" + total.ToString("n2"); p2Winner.Show(); } //end if } //end void method
}//end void method public void validatePlayerOneSpin() { //created object for the first player wheel player1 = new wheel(); guesser guesser1 = new guesser(); //get the spin to determine where numbers fall int p1Spin = player1.getSpin(); int number = -1000; if (p1Spin == -1000) { MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON -1000 " + "\nTHIS MEANS YOU LOST A TURN" + "\nAND LOST $1000"); //calculating total then returning it player1.calculateMoney(number); int total = player1.getTotalMoney(); //printing it back out from what was calculated txtPlayerOne.Text = "$" + total.ToString("n2"); MessageBox.Show("Next players turn"); //hide buttons and messages on the load btnSpinPlayerOne.Hide(); btnSolvePlayerOne.Hide(); lblMessageOne.Hide(); btnSpinPlayerTwo.Show(); btnSolvePlayerTwo.Show(); lblMessageTwo.Show(); btnSpinPlayerThree.Hide(); btnSolvePlayerThree.Hide(); lblMessageThree.Hide(); }//end if else if (p1Spin == 0) { MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON 0 " + "\nTHIS MEANS YOU LOST A TURN"); number = 0; player1.calculateMoney(number); int total = player1.getTotalMoney(); txtPlayerOne.Text = "$" + total.ToString("n2"); MessageBox.Show("Next players turn"); //hide buttons and messages on the load btnSpinPlayerOne.Hide(); btnSolvePlayerOne.Hide(); lblMessageOne.Hide(); btnSpinPlayerTwo.Show(); btnSolvePlayerTwo.Show(); lblMessageTwo.Show(); btnSpinPlayerThree.Hide(); btnSolvePlayerThree.Hide(); lblMessageThree.Hide(); }//end else if else { number = 0; player1.calculateMoney(number); int total = player1.getTotalMoney(); txtPlayerOne.Text = "$" + total.ToString("n2"); MessageBox.Show("Your spin landed on $" + p1Spin + " dollars"); this.Hide(); guesser1.Show(); } //end else } //end void validation for first player
} //end void method validation for the second player public void validatePlayerThreeSpin() { wheel player3 = new wheel(); guesserThree gusser3 = new guesserThree(); int number = -1000; int p3Spin = player3.getSpin(); if (p3Spin == -1000) { MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON -1000 " + "\nTHIS MEANS YOU LOST A TURN" + "\nAND LOST $1000"); player3.calculateMoney(number); int total = player3.getTotalMoney(); txtPlayerThree.Text = "$" + total.ToString("n2"); MessageBox.Show("Next players turn"); //hide buttons and messages on the load btnSpinPlayerTwo.Hide(); btnSolvePlayerTwo.Hide(); lblMessageTwo.Hide(); btnSpinPlayerOne.Show(); btnSolvePlayerOne.Show(); lblMessageOne.Show(); btnSpinPlayerThree.Hide(); btnSolvePlayerThree.Hide(); lblMessageThree.Hide(); }//end if else if (p3Spin == 0) { MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON 0 " + "\nTHIS MEANS YOU LOST A TURN"); number = 0; player3.calculateMoney(number); int total = player3.getTotalMoney(); txtPlayerThree.Text = "$" + total.ToString("n2"); this.Hide(); MessageBox.Show("Next players turn"); // txtPlayerOne.Focus(); //hide buttons and messages on the load btnSpinPlayerTwo.Hide(); btnSolvePlayerTwo.Hide(); lblMessageTwo.Hide(); btnSpinPlayerOne.Show(); btnSolvePlayerOne.Show(); lblMessageOne.Show(); btnSpinPlayerThree.Hide(); btnSolvePlayerThree.Hide(); lblMessageThree.Hide(); }//end else if else { number = 0; player3.calculateMoney(number); int total = player3.getTotalMoney(); txtPlayerThree.Text = "$" + total.ToString("n2"); MessageBox.Show("Your spin landed on $" + p3Spin + " dollars"); this.Hide(); gusser3.Show(); } //end else } //end void method validation for the third player
}//end void method private void btnSolve_Click(object sender, EventArgs e) { try { wheelOfFortune finish = new wheelOfFortune(); wheel player1Money = new wheel(); wheel player2Money = new wheel(); wheel player3Money = new wheel(); //make 3 guessers have a answer method in there class to use here guesser g1 = new guesser(); guesserTwo g2 = new guesserTwo(); guesserThree g3 = new guesserThree(); //if and else statements for player 1 if (g1.answer() == "SOFTWARE DEVELOPER" && txtSolve.Text == "SOFTWARE DEVELOPER") { txtSolve.Text = "SOFTWARE DEVELOPER"; int total = player1Money.getTotalMoney(); MessageBox.Show("Congratulations player one has won the game!" + "\nAmount of money won: " + total.ToString("n2")); //calling a void method gameOver(); }//end if else { MessageBox.Show("OOPS that is not the right answer....Next players turn"); this.Hide(); finish.Show(); //hide buttons and messages finish.btnSpinPlayerOne.Hide(); finish.btnSolvePlayerOne.Hide(); finish.lblMessageOne.Hide(); finish.btnSpinPlayerTwo.Show(); finish.btnSolvePlayerTwo.Show(); finish.lblMessageTwo.Show(); finish.btnSpinPlayerThree.Hide(); finish.btnSolvePlayerThree.Hide(); finish.lblMessageThree.Hide(); }//end else //if and else statements for player 2 if (g2.answer() == "SOFTWARE DEVELOPER" && txtSolve.Text == "SOFTWARE DEVELOPER") { txtSolve.Text = "SOFTWARE DEVELOPER"; int total = player2Money.getTotalMoney(); MessageBox.Show("Congratulations player two has won the game!" + "\nAmount of money won: " + total.ToString("n2")); //calling a void method gameOver(); }//end if else { MessageBox.Show("OOPS that is not the right answer....Next players turn"); this.Hide(); finish.Show(); //hide buttons and messages finish.btnSpinPlayerOne.Hide(); finish.btnSolvePlayerOne.Hide(); finish.lblMessageOne.Hide(); finish.btnSpinPlayerTwo.Hide(); finish.btnSolvePlayerTwo.Hide(); finish.lblMessageTwo.Hide(); finish.btnSpinPlayerThree.Show(); finish.btnSolvePlayerThree.Show(); finish.lblMessageThree.Show(); }//end else //if and else statements for player 3 if (g3.answer() == "SOFTWARE DEVELOPER" && txtSolve.Text == "SOFTWARE DEVELOPER") { txtSolve.Text = "SOFTWARE DEVELOPER"; int total = player3Money.getTotalMoney(); MessageBox.Show("Congratulations player three has won the game!" + "\nAmount of money won: " + total.ToString("n2")); //calling a void method gameOver(); }//end if else { MessageBox.Show("OOPS that is not the right answer....Next players turn"); this.Hide(); finish.Show(); //hide buttons and messages finish.btnSpinPlayerOne.Show(); finish.btnSolvePlayerOne.Show(); finish.lblMessageOne.Show(); finish.btnSpinPlayerTwo.Hide(); finish.btnSolvePlayerTwo.Hide(); finish.lblMessageTwo.Hide(); finish.btnSpinPlayerThree.Hide(); finish.btnSolvePlayerThree.Hide(); finish.lblMessageThree.Hide(); } //end else } //end try catch (FormatException formatE) { MessageBox.Show(formatE.Message); }//end catch catch (Exception ex) { MessageBox.Show(ex.Message); } //end catch } //end void method