dcsimg
Results 1 to 5 of 5

Thread: Console Application To HTML

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    3

    Question Console Application To HTML

    How would I go about modifying the following console application? It calculates resistor color codes and I need it to be able to launch or work directly from a HTML web page. Any help would be appreciated. Thanks in advance.

    (I'm well aware my calculator can be simplified with case statements and loops, only bother with that if you want to.)

    Code:
    :Module Module1
    
        Sub Main()
            Dim tens As Integer
            Dim ones As Integer
            Dim expnt As Integer
            Dim tol As String
            Dim answer As Long
    readcolor1:
            Console.Write("Please enter your first color: ")
            Dim color1 As String = Console.ReadLine().ToLower
            If color1 = "black" Then
                tens = 0
            ElseIf color1 = "brown" Then
                tens = 1
            ElseIf color1 = "red" Then
                tens = 2
            ElseIf color1 = "orange" Then
                tens = 3
            ElseIf color1 = "yellow" Then
                tens = 4
            ElseIf color1 = "green" Then
                tens = 5
            ElseIf color1 = "blue" Then
                tens = 6
            ElseIf color1 = "violet" Then
                tens = 7
            ElseIf color1 = "grey" Then
                tens = 8
            ElseIf color1 = "gray" Then
                tens = 8
            ElseIf color1 = "white" Then
                tens = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor1
            End If
    readcolor2:
            Console.Write("Please enter your second color: ")
            Dim color2 As String = Console.ReadLine().ToLower
            If color2 = "black" Then
                ones = 0
            ElseIf color2 = "brown" Then
                ones = 1
            ElseIf color2 = "red" Then
                ones = 2
            ElseIf color2 = "orange" Then
                ones = 3
            ElseIf color2 = "yellow" Then
                ones = 4
            ElseIf color2 = "green" Then
                ones = 5
            ElseIf color2 = "blue" Then
                ones = 6
            ElseIf color2 = "violet" Then
                ones = 7
            ElseIf color2 = "grey" Then
                ones = 8
            ElseIf color2 = "gray" Then
                ones = 8
            ElseIf color2 = "white" Then
                ones = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor2
            End If
    readcolor3:
            Console.Write("Please enter your third color: ")
            Dim color3 As String = Console.ReadLine().ToLower
            If color3 = "black" Then
                expnt = 0
            ElseIf color3 = "brown" Then
                expnt = 1
            ElseIf color3 = "red" Then
                expnt = 2
            ElseIf color3 = "orange" Then
                expnt = 3
            ElseIf color3 = "yellow" Then
                expnt = 4
            ElseIf color3 = "green" Then
                expnt = 5
            ElseIf color3 = "blue" Then
                expnt = 6
            ElseIf color3 = "violet" Then
                expnt = 7
            ElseIf color3 = "grey" Then
                expnt = 8
            ElseIf color3 = "gray" Then
                expnt = 8
            ElseIf color3 = "white" Then
                expnt = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor3
            End If
    readcolor4:
            Console.Write("Please enter your fourth color: ")
            Dim color4 As String = Console.ReadLine().ToLower
            If color4 = "gold" Then
                tol = "+/- 5%"
            ElseIf color4 = "silver" Then
                tol = "+/- 10%"
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor4
            End If
    
            answer = ((tens * 10) + ones) * 10 ^ expnt
            Console.Write(answer & " OHMS " & tol)
            Console.ReadLine()
            GoTo readcolor1
        End Sub
    
    End Module
    Last edited by NicTyn; Oct 31st, 2011 at 05:24 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width