Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2007
    Thanked 0 Times in 0 Posts

    Visual basic Help

    I have a VB assignment due this evening and need help with the psuedocode I am very lost on this one. Any help would be great!

    ' First declare and initialize variables

    Declare an array Rainfall(12) of data type Single
    Declare TotalRainfall of data type Single
    Declare AvgRainfall of data type Single
    Declare AboveAvgCount and BelowAvgCount of data type Integer

    ‘Initialize TotalRainfall to zero
    Set TotalRainfall to zero

    ‘Set up a for loop to input monthly rainfall amounts, store them in the array,
    ‘and add them to TotalRainfall

    For K ranging from 1 to 12
    Display a prompt and get user input
    Convert it to Single and store in Rainfall( K)
    Add Rainfall ( K ) to TotalRainfall
    End of For loop

    ‘Calculate average rainfall
    Compute AvgRainfall as TotalRainfall divided by 12

    ‘Initialize the counts
    Initialize AboveAvgCount and BelowAvgCount to zero

    ‘Using a for loop again compare the average rainfall to each monthly rainfall
    ‘and count the above-rainfall months and below-rainfall months
    For K ranging from 1 to 12
    If Rainfall( K) > AvgRainfall then
    Increment AboveAvgCount by 1
    else if Rainfall(K) < AvgRainfall then
    Increment BelowAvgCount by 1
    End of if statement
    End of For loop

    ‘Display the computed results
    Display TotalRainfall, AvgRainfall, AboveAvgCount, and BelowAvgCount with suitable messages.

  2. #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Thanked 210 Times in 209 Posts
    i don't understand... you are trying to write more pseudo code? or are you trying to make the pseudo code into vb? (I assume the latter)... if the first case you already have pseudo code written and we need the requirements to help you write more... if what I assume and you are trying to write the VB then we need to see what you have done... if you don't know how to declare a variable in VB then you have not been paying attention in class
    Dim something as something

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


Posting Permissions

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