Results 1 to 4 of 4

Thread: [2005] Trivial Percent Question

Threaded View

  1. #1

    Thread Starter
    Addicted Member Abrium's Avatar
    Join Date
    Feb 2007
    Location
    The Great State of Texas
    Posts
    205

    Resolved [2005] Trivial Percent Question

    I have tried different conversions but after 45 minutes about out of ideas as to why when I run this prog I end up with 10,000.00% instead of 100.00%. As usual I searched format issues and percentage but turned up nothing relavent to me with in the first couple of pages.

    Here is the code I'm using and the input i am using is 1 test to be graded and the grade is 100%.

    VB Code:
    1. Dim intCount As Integer = 1
    2.         Dim decTotal As Decimal = 0
    3.         Dim strNumOfTests As String
    4.         Dim strTotalTests As String
    5.         Dim intNumOfTests As Integer
    6.  
    7.  
    8.  
    9.         'Display input box for the number of tests
    10.         strNumOfTests = InputBox("How many tests need to be graded? " _
    11.         , "Number of tests", "5")
    12.         intNumOfTests = CInt(strNumOfTests)
    13.  
    14.         Do Until intCount > CInt(strNumOfTests)
    15.  
    16.             strTotalTests = InputBox("Please enter the score for test # " _
    17.             & intCount.ToString, "Test Scores")
    18.             intCount += 1
    19.             decTotal += CDec(strTotalTests)
    20.  
    21.         Loop
    22.  
    23.         'Make the If statements that are going to provide
    24.         'a letter grade with the socre.
    25.  
    26.         If decTotal >= 90 Then
    27.             lblAverageScore.Text = ("You scored " & FormatPercent(decTotal.ToString, 2) _
    28.             & " which is an A.  Good Job!")

    I know with in 5 minutes someone with far more experience then I have is going to nail this and make me look like an idiot but I'm willing to suffer the humiliation as long as I get an answer with a reason lol...

    Later
    Abe
    Last edited by Abrium; Feb 20th, 2007 at 06:10 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width