Create a project named GuessANumber with a Form that contains a guessing game wi
ID: 665789 • Letter: C
Question
Create a project named GuessANumber with a Form that contains a guessing game with five RadioButtons numbered 1 through 5. Randomly choose one of the RadioButtons as the winning button. When the user clicks a RadioButton, display a message indicating whether the user is right.
Add a Label to the Form that provides a hint. When the user’s mouse hovers over the label, notify the user of one RadioButton that is incorrect. After the user makes a selection, disable all the RadioButtons. (Farrell 670-671)
I need this in C#
Explanation / Answer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void HINT_MouseHover(object sender, EventArgs e)
{
HoverLocationLabel.Text = "it's an even number";
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if(Button1CheckBox.Checked)
radioButton1.Text = "incorrect";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (Button2CheckBox.Checked)
radioButton2.Text = "incorrect";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
if (Button3CheckBox.Checked)
radioButton3.Text = "incorrect";
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
if (Button4CheckBox.Checked)
radioButton4.Text = "incorrect";
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
if (Button5CheckBox.Checked)
radioButton5.Text = "incorrect";
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.