Wolves and Sheep Exercise In this studio, you will concentrate on data validation using if clauses. You will complete a program that requires the user to solve a puzzle. In this puzzle, you need to help three sheep and three wolves cross a river. They can use a raft that holds a minimum of one and a maximum of two animals at a time. Beware: If the wolves outnumber the sheep on either bank, the sheep will be eaten up. You are given a partial program for this puzzle. You can download the program code from here. After you download the application, make sure you extract the files first and then click on the solution object to open the application. You will probably have to allow it to convert the files as well--Visual Studio will tell you if it needs to do this. Once it's open, run the program to see how it works. It allows you move sheep and wolves from one side to another. It disables the move button on the other side of the bank to make sure the raft can only move in one direction. The given program does not have any error checking. In this studio, you will add the error checking to the "Move To Right" button only. You need not make any other changes to the program. If you have time, you can copy the code you generate to the "Move to Left" button and adapt it to the left side to complete the program. You can find the completed executable program here, if you want to check against it. First add code to check that the input data contains numbers. If there is a problem, display an error message in the label (lblMessage). Cut and paste your if statement(s) below. Student Response: If Not IsNumeric(Me.txtWolfToMove.Text) Or Not IsNumeric(Me.txtSheepToMove.Text) Then MsgBox("Enter a valid number of wolf and sheep to transfer") Me.txtWolfToMove.Text = Nothing Me.txtSheepToMove.Text = Nothing Exit Sub Score: 10/10 3. Now, add code to check that we are moving 1 or 2 animals. If there is a problem, display an error message in the label (lblMessage). Cut and paste your if statement(s) below. Student Response: Dim condAnimalMovingLimit As Boolean condAnimalMovingLimit = (Val(txtWolfToMove.Text) + Val(txtSheepToMove.Text) <= 2) AndAlso (Val(txtWolfToMove.Text) + Val(txtSheepToMove.Text) >= 0) ElseIf Not condAnimalMovingLimit Then lblMessage.Text = "Enter a valid number of wolf and sheep to transfer" Me.txtWolfToMove.Text = Nothing Me.txtSheepToMove.Text = Nothing Exit Sub Score: 8/10 Comments: awkward code, wouldn't run or compile. You need an if statement with your ElseIf. 4. Now, add code to check that we are not moving more animals than are left on the bank of the river. For example, if I want to move two animals, there must be at least two animals on that side of the river bank. If there is a problem, display an error message in the label (lblMessage). Cut and paste your if statement(s) below. Student Response: Dim EnoughAnimalLimit As Boolean EnoughAnimalLimit = (Val(txtSheepToMove.Text) <= Val(lblLeftSheepCount.Text)) Or (Val(txtWolfToMove.Text) <= Val(lblLeftWolfCount.Text)) ----------------- ElseIf Not condAnimalMovingLimit Or Not EnoughAnimalLimit Then lblMessage.Text = "Enter a valid number of wolf and sheep to transfer" Me.txtWolfToMove.Text = Nothing Me.txtSheepToMove.Text = Nothing Exit Sub Score: 10/10 5. Now, add code to check whether sheep outnumber the wolves on either bank after the move. If so, disable both the move buttons (using the buttons' Enabled property) and notify the user that they lost the game. Cut and paste your if statement(s) below. Student Response: 'Player loses checker If ((Val(lblLeftWolfCount.Text) > Val(lblLeftSheepCount.Text)) And Val(lblLeftSheepCount.Text) > 0) Or ((Val(lblRightWolfCount.Text) > Val(lblRightSheepCount.Text)) And Val(lblRightSheepCount.Text > 0)) Then lblMessage.Text = "You have lost!" Me.btnMoveToRight.Enabled = False Me.btnMoveToLeft.Enabled = False End If Score: 10/10 6. Show your code to the TA and get their approval code. If you have finished the program, see if you can you solve the puzzle. Student Response Value 1. sean henley 0% Score: 0/10 New score: 10/10 This score has been adjusted by the grader.