View Full Version : Visual basic Help

11-29-2011, 03:15 AM
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.

11-30-2011, 12:22 AM
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