Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

Help coverting console app to form app

$
0
0
I have to create a diving competition program and I'm stuck on how to create it in a form app. Here is the requirements:

1. Needs to be able to keep score for up to 16 divers, record their last name, record the name of their dives,

2. Each diver has 8 dives.

3. There are 8 judges scoring each dives w/scores ranging from 0-10 w/one decimal place. Throw-out the highest & the lowest to get the score of their dive.

4. Include the degree of difficulty of the dives from 1-4 w/two decimal places.

5. Add all 6 and multiply by the degree of difficulty to get those scores.

Here is the program I started working on as a console app. It doesn't compile yet as there is build errors so I'd need help with that first and then I need to convert it to a form app. I'm quite new to VB.NET and have no clue how to create a form app. The only reason I know how to create a console app. is based on my programming experience. For the GUI I would like to use a listbox (for the names), a text box (for the Degree of difficulty), 8 numeric up down controls, a button to indicate 'Update" and a label to show the score. I really need help and so if anyone would be willing to help me either convert this console app to a form app, or help me start coding this from scratch in a form app. that would be greatly apprecaited!!!

Code:

Private Shared Sub Main(args As String())
        Dim totalDivers As Integer
        Dim diverScore As Single, degOfDiff As Single, avgDivingScores As Single
        Dim diverName As String, diverCity As String, diverEvent As String

        Console.WriteLine("Begin entering diver's information.")
        Console.WriteLine("Are there any diver's?: ")
        Dim divers As String = Convert.ToString(Console.Read())

        If divers = "Y" OrElse divers = "y" Then
                Do
                        Console.WriteLine("Event: ")
                        diverEvent = Convert.ToString(Console.Read())
                        Console.WriteLine()

                        Console.WriteLine("Enter the diver's name: ")
                        diverName = Convert.ToString(Console.Read())
                        Console.WriteLine()

                        Console.WriteLine("Enter the diver's city: ")
                        diverCity = Convert.ToString(Console.Read())
                        Console.WriteLine()

                        Console.WriteLine("Enter the score given by judge #1: ")
                        diverScore = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If diverScore < 0 OrElse diverScore > 10 Then
                                Console.WriteLine("Invalid score - Please reenter" & " (Valid Range = 0-10) : ")
                                diverScore = Convert.ToString(Console.Read())
                        End If

                        Console.WriteLine("Enter the score given by judge #2: ")
                        diverScore = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If diverScore < 0 OrElse diverScore > 10 Then
                                Console.WriteLine("Invalid score - Please reenter" & " (Valid Range = 0-10) : ")
                                diverScore = Convert.ToString(Console.Read())
                        End If

                        Console.WriteLine("Enter the score given by judge #3: ")
                        diverScore = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If diverScore < 0 OrElse diverScore > 10 Then
                                Console.WriteLine("Invalid score - Please reenter" & " (Valid Range = 0-10) : ")
                                diverScore = Convert.ToString(Console.Read())
                        End If

                        Console.WriteLine("Enter the score given by judge #4: ")
                        diverScore = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If diverScore < 0 OrElse diverScore > 10 Then
                                Console.WriteLine("Invalid score - Please reenter" & " (Valid Range = 0-10) : ")
                                diverScore = Convert.ToString(Console.Read())
                        End If

                        Console.WriteLine("Enter the score given by judge #5: ")
                        diverScore = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If diverScore < 0 OrElse diverScore > 10 Then
                                Console.WriteLine("Invalid score - Please reenter" & " (Valid Range = 0-10) : ")
                                diverScore = Convert.ToString(Console.Read())
                        End If

                        Console.WriteLine("What was the degree of difficulty?: ")
                        degOfDiff = Convert.ToString(Console.Read())
                        Console.WriteLine()
                        If degOfDiff < 1.0 OrElse degOfDiff > 1.67 Then
                                Console.WriteLine("Invalid degree of difficulty - Please reenter" & " (Valid Range = 1.00-1.67) : ")
                                degOfDiff = Convert.ToString(Console.Read())
                        Else
                                Console.WriteLine("Diver: {0}" & vbLf, diverName)
                                Console.WriteLine("City: {0}" & vbLf, diverCity)
                        End If

                        Console.WriteLine("Do you want to process another diver? :")

                        Convert.ToString(Console.Read())
                Loop While divers = "Y" OrElse divers = "y"
                ElseIf divers = "N" OrElse divers = "n" Then
                Console.WriteLine("Event Summary" & vbLf & vbLf)

                'totalDivers =
                Console.Write("Number of participating divers: {0}", totalDivers)

                'avgDivingScores /= totalDivers;
                Console.Write("Average score of all divers: {0}", avgDivingScores)
        Else
                Console.WriteLine("Invalid, please enter Y/y or N/n")
        End If
End Sub


Viewing all articles
Browse latest Browse all 27189

Trending Articles