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

it must be as Visual Systems Development. In this assignment you are to design,

ID: 666313 • Letter: I

Question

it must be as Visual Systems Development.

In this assignment you are to design, code, debug and implement a program which correctly plays the game of RockPaperScissors. The program must display each player’s choices and indicate who wins each game. It must keep each player’s total score as well as the number of ties. The game rules are that Rock beats Scissors, Scissors beats Paper and Paper beats Rock.

Your program must declare variables with meaningful names as needed.

It must also create and name objects on the form appropriately.

It must use Alt key shortcuts and have an efficiently organized user interface.

The layout of your form does not have to look like the sample program, but ALL of the features must be there. It must have a NewGame button which clears the scores and a Show/Hide Score button which is designated as the Accept Button.

Rock Paper Scissors Game Rock Paper Scissors Gane Current Play Human Computer: Rock Winner: It's a Tie Rock Rock Paper Scissors Scores Human: Computer: 2 Ties: Hide Score New Game Exit

Explanation / Answer

working visual basic code

Private Sub goButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles goButton.Click

      Randomize()

      Dim num As Integer ' variable to hold random number (computer choice)
      Const ROCK = 1
      Const PAPER = 2
      Const SCISSORS = 3

      num = CInt((3 * Rnd())) ' generate random numbers 1-3
      Static Dim winCount As Integer = 0
      Static Dim matchCount As Integer = 0
      Static Dim compCount As Integer = 0

      If rockRadioButton.Checked And num = ROCK Then
         resultLabel.Text = "Computer chose Rock too. Tie!"
      ElseIf rockRadioButton.Checked And num = PAPER Then
         resultLabel.Text = "Computer chose paper. You Lose!"
         compCount += 1
      ElseIf rockRadioButton.Checked And num = SCISSORS Then
         resultLabel.Text = "Computer threw scissors. You Win!"
         winCount += 1
      ElseIf paperRadioButton.Checked And num = ROCK Then
         resultLabel.Text = "Computer chose Rock. You Win!"
         winCount += 1
      ElseIf paperRadioButton.Checked And num = PAPER Then
         resultLabel.Text = "Computer chose paper too. Tie!"
      ElseIf paperRadioButton.Checked And num = SCISSORS Then
         resultLabel.Text = "Computer threw scissors. You Lose!"
         compCount += 1

      ElseIf scissorsRadioButton.Checked And num = ROCK Then
         resultLabel.Text = "Computer chose Rock. You Lose!"
         compCount += 1
      ElseIf scissorsRadioButton.Checked And num = PAPER Then
         resultLabel.Text = "Computer chose paper. You Win!"
         winCount += 1
      ElseIf scissorsRadioButton.Checked And num = SCISSORS Then
         resultLabel.Text = "Computer chose scissors too. Tie!"
      End If

      'condition to check if you have won three times
      If compCount = 2 Then
         winLabel.Text = "Game over. Computer Wins. Play Again."

      ElseIf winCount = 2 Then
         winLabel.Text = "You won the best of 3! Congrats!"
      End If

   End Sub