Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Windows Forms Visual Studios You are to create the classic game of Wheel of F

ID: 3774376 • Letter: C

Question

C# Windows Forms Visual Studios You are to create the classic game of Wheel of Fortune. Your application should consist of 3 players, underlines to represent letters in the puzzle, and the available letters. The initial screen should look something like: Note: My puzzle is "Pulp Fiction" but pick your own puzzle Notice that Player 1 goes first (see note at bottom of screen) and can either spin or guess the puzzle by clicking the appropriate button. If Player 1 spins, then the wheel will spin. To represent the wheel, create a random number from 1 to 10. Each will represent a spot on the wheel. Here are the wheel values: Random number 1: $100 Random number 2: S300 Random number 3: S500 Random number 4: S700 Random number 5: $900 Random number 6: $2000 Random number 7: $3000 Random number 8: $5000 Random number 9: -S1000 player loses S 1000 from his/her total and loses that turn Random number 10: $0 player only loses turn

Explanation / Answer

Program.cs

using System;

using Syatem.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

static class Program

{

[STAThread]

static void Main()

{

Application.EnableVisulaStyles();

Application.setCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

}

}

Form1.Designer.cs

namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.Box1 = new System.Windows.Forms.TextBox();
this.Box2 = new System.Windows.Forms.TextBox();
this.Box3 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox12 = new System.Windows.Forms.TextBox();
this.textBox13 = new System.Windows.Forms.TextBox();
this.textBox14 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 195);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "guess";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(386, 195);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "spin";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Box1
//
this.Box1.Location = new System.Drawing.Point(107, 325);
this.Box1.Name = "Box1";
this.Box1.ReadOnly = true;
this.Box1.Size = new System.Drawing.Size(100, 20);
this.Box1.TabIndex = 2;
this.Box1.Text = "$0";
//
// Box2
//
this.Box2.Location = new System.Drawing.Point(334, 325);
this.Box2.Name = "Box2";
this.Box2.ReadOnly = true;
this.Box2.Size = new System.Drawing.Size(100, 20);
this.Box2.TabIndex = 3;
this.Box2.Text = "$0";
//
// Box3
//
this.Box3.Location = new System.Drawing.Point(566, 325);
this.Box3.Name = "Box3";
this.Box3.ReadOnly = true;
this.Box3.Size = new System.Drawing.Size(100, 20);
this.Box3.TabIndex = 4;
this.Box3.Text = "$0";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(135, 309);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 5;
this.label1.Text = "player1";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(361, 309);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 13);
this.label2.TabIndex = 6;
this.label2.Text = "player2";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(596, 309);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 13);
this.label3.TabIndex = 7;
this.label3.Text = "player3";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(80, 65);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(25, 20);
this.textBox4.TabIndex = 8;
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(355, 65);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(25, 20);
this.textBox5.TabIndex = 9;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(386, 65);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(25, 20);
this.textBox6.TabIndex = 10;
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(448, 65);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(25, 20);
this.textBox7.TabIndex = 11;
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(479, 65);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(25, 20);
this.textBox8.TabIndex = 12;
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(417, 65);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(25, 20);
this.textBox9.TabIndex = 13;
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(510, 65);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(25, 20);
this.textBox10.TabIndex = 14;
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(169, 65);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(25, 20);
this.textBox11.TabIndex = 15;
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(138, 65);
this.textBox12.Name = "textBox12";
this.textBox12.Size = new System.Drawing.Size(25, 20);
this.textBox12.TabIndex = 16;
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(107, 65);
this.textBox13.Name = "textBox13";
this.textBox13.Size = new System.Drawing.Size(25, 20);
this.textBox13.TabIndex = 17;
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(541, 65);
this.textBox14.Name = "textBox14";
this.textBox14.Size = new System.Drawing.Size(25, 20);
this.textBox14.TabIndex = 18;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(328, 373);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(0, 13);
this.label4.TabIndex = 19;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(688, 404);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox14);
this.Controls.Add(this.textBox13);
this.Controls.Add(this.textBox12);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.textBox10);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.Box3);
this.Controls.Add(this.Box2);
this.Controls.Add(this.Box1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox Box1;
private System.Windows.Forms.TextBox Box2;
private System.Windows.Forms.TextBox Box3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.TextBox textBox13;
private System.Windows.Forms.TextBox textBox14;
private System.Windows.Forms.Label label4;
}
}

Form1.cs

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

static int playercode=0;

public Form1()

{

IntilizeComponent();

}

private vooid button2_Click(object sender,EventArgs e)

{

string rand="";

playerCode++;

switch(playerCode%3)

{

case 1: Box1.Text=fun(Box1.Text,out rand);

break;

case 2: Box2.Text=fun(Box2.Text,out rand);

break;

case 0: Box3.Text=fun(Box3.Text,out rand);

break;

default:break;

}

label4.Text="Random Value:"+rand;

}

static string fun(string oldValue,out string val)

{

val="";

switch(new Random().Next(1,10))

{

case 1:val="$"+100;

break;

case 2: val = "$" + 300;
break;
case 3: val = "$" + 500;
break;

case 4: val = "$" + 700;

break;

case 5: val = "$" + 900;

break;
case 6: val = "$" + 2000;
break;
case 7: val = "$" + 3000;
break;
case 8: val = "$" + 5000;
break;
case 9: val = "-$1000";
break;

case 10: val = "$" + 0;
break;
default:
break;
}

int newVal= int.Parse(oldValue.Replace("$", "")) + int.Parse(val.Replace("$", ""));
return "$"+newVal;

}
private void Form1_Load(object sender, EventArgs e)
{

}

}
}