(Solved) : Started Vb Code T Seem Get Instructions Say Someone Please Fix Code Code Public Class Frmn Q42733367 . . .

I started this VB code and I can’t seem to get it to do asinstructions say. Can someone please fix my code.

My Code:

Public Class frmNumbers
Dim strName As String = ” What Is your Name: “
Dim strNumber As String = ” Enter a whole number: “
Dim strNonNumeric As String = ” Error: Enter Numeric Number “
Dim decInput As Decimal
Dim intNumberEntries As Integer = 1
Dim intMaxEntries As Integer = 6
Dim decTotalOdd As Decimal
Dim decTotalEven As Decimal

Private Sub btnStart_Click(sender As Object, e As EventArgs)Handles btnStart.Click
lstResults.Items.Clear()
strName = InputBox(strName)
strNumber = InputBox(strNumber)
Try
Dim decNumber As Decimal = Convert.ToDecimal(strNumber)
decNumber = decInput
If (decInput Mod 2 = 0) Then
MsgBox(“This Number is Even”)
ElseIf decInput Mod 2 = 1 Then
MsgBox(“This Number is Odd”)

Catch ex As Exception

End Try
Do Until intMaxEntries = 6
Loop

lstResults.Items.Add(” Name: ” & strName)
lstResults.Items.Add(“Number: ” & decInput)
End Sub
End Class

Instructions:

A sample number game involves a user entering a positiveinteger, and the program deciding whether the number entered wasodd or even.

More specifically, write a VB 2017 program to ask user forhis/her name and a whole number (via InputBoxes). The programshould then decide whether the number is odd or even, and keep acounter of each (odds/evens). This process should continue for 6valid numbers entered by the user. Checkfor invalid numbers as they are entered. Invalidnumbers are non-numeric ones (e.g. three) or onesthat are not positive. Make sure the program is user-friendly and”forgiving,” allowing the user as many times as needed to retry”invalid” data. Use loops (counting loops to control the 6sessions of this game, and conditional loops to ensure theinput data are valid).

Your interface should simply consist of a single button (Start)and an output listbox, with 2 other user actions (halting, andclearing) handled through a menu control on the form. Your “Quit”menu option should pop up a farewell message box with either themessage “This was an ODD game. Goodbye!”, or the message “You arepretty EVEN handed. Goodbye!” (depending on whether more odds orevens were entered by the user).or a third “balanced” message for”ties.”

Your output listbox should display the results of the 6 sessionsin a formatted style, as follows:

Odd or Even Game Results for Pete Moss
Trial

Number

1

212

2 1079
3 33
4 21
5 17
6 5
You entered 5 odd number(s)
You entered 1 even number(s)

Expert Answer


Answer to I started this VB code and I can’t seem to get it to do as instructions say. Can someone please fix my code. My Code: Pu…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us