private void btnScore_Click(object sender, EventArgs e) { if (rbAdult.Checked) dScoringComputer = new DScore(Scorer.AdultScore); if (rbChild.Checked) dScoringComputer = new DScore(Scorer.ChildScore); try { correct = Int32.Parse(tbCorrectAns.Text); incorrect = Int32.Parse(tbIncorrectAns.Text); DisplayPoints(dScoringComputer, correct, incorrect); } catch (FormatException) { MessageBox.Show("Please enter two valid whole numbers."); } }
private void btnScore_Click(object sender, EventArgs e) { if (rbAdult.Checked) { dScoringComputer = new DScore(Scorer.AdultScore); } if (rbChild.Checked) { dScoringComputer = new DScore(Scorer.ChildScore); } try { correct = Int32.Parse(tbCorrectAns.Text); incorrect = Int32.Parse(tbIncorrectAns.Text); DisplayPoints(dScoringComputer, correct, incorrect); } catch (FormatException) { MessageBox.Show("Please enter two valid whole numbers."); } }
public void DisplayPoints(DScore dscoreComputer, int correct, int incorrect) { int displayScore = dscoreComputer(correct, incorrect); lbScore.Text = displayScore.ToString(); }