Convert Pseudo Code To Visual Basic

hbz3xtreme

New member
Joined
Dec 16, 2016
Messages
1
Programming Experience
Beginner
I'm new and have no idea how to do it, it needs to be combined.

start
perform housekeeping()
while not eof
perform mainLoop()
endwhile
perform finishUp()
stop

housekeeping()
declare variables
open files
perform headings()
read soccerRec
return

mainLoop()
print soccerFirst, soccerLast, soccerTeam, teamName[soccerTeam]
read soccerRec
return

headings()
print heading1
print heading2
return

finishUp()
close files
return
start
perform housekeeping()
while not eof
perform mainLoop()
endwhile
perform finishUp()
stop

housekeeping()
declare variables
open files
perform headings()
read soccerRec
return

mainLoop()
count[soccorTeam] = count[soccorTeam] + 1
read soccerRec
return

headings()
print heading1
print heading2
return

finishUp()
soccorTeam = 1
while soccerTeam <= 5
print teamName[soccerTeam], count[soccerTeam]
soccerTeam = soccerTeam + 1
end while
close files
return
 
I'm new and have no idea how to do it, it needs to be combined.

Then you should start learning VB.NET then. This is not a code-writing service but we can help you with specific issues. There's a link to a beginner tutorial in my signature and I would suggest that you work your way through that. If you have to convert pseudo-code to VB.NET code then I assume that this is for a class or course of some sort so I would think that you're already learning some VB.NET. If you have no idea at all then I'd suggest that you should go back and review what you've learned so far because you're not going to be assigned something that you haven't been given the tools to complete. Basically what I'm saying is that you need to try a bit harder to make a start at least because if you really can't do anything at all with the problem then I'd have to conclude that you should try something other than VB.NET programming.
 
Let me provide an example. This is from your pseudo-code:
VB.NET:
housekeeping()
declare variables
open files
perform headings()
read soccerRec
return
It says there "declare variables". Are you really telling me that you don't know how to declare variables? If you're not saying that then there's something you can do so why haven't you don it? It also says "open files". Do you know how to open a file in VB.NET? If so, why haven't you done it? If not, what effort have you made to find out? Basically, what you're doing is looking at the problem as a whole and assuming it's too hard. You need to break the problem down into parts. That's not hard because the pseudo code is broken down into sections and each section is broken down into lines. It's already done for you.
 
declare variables
That's not something you would put in pseudo code. Declaring variables should not be a separate step (and is not a description of code functionality), they are placeholders to keep some state during what code does, and should be declared when you need them, with closest scope needed. Example, need to keep result of a computation:
Dim result = A + B

Sometimes one needs a variable outside a code block for use inside the code block, then you would declare it with a default/empty value. Example, and this is no exception to the rule "declare when needed":
Dim result = 0
For c = 1 To 10
    result += c
Next


Declaring when needed also allows you to use type inference rather than explicitly declaring the type. Look at these examples:
Dim result ' no type given, no value assigned, type is implicitly Object, which is wrong since need to keep Integer values
Dim result = 0 ' type is implicitly Integer
Dim result As Integer 'type is explicitly Integer, variable is unassigned, was this variable actually needed at this time?
Dim result As Integer = 0 'type is explicitly Integer, value set, may have written more code than necessary

Notice c variable in previous example? That is declared and type inferred with the For statement, no separate declaration needed.
 
Back
Top