Start New Discussion within our Software Development Community

I Have To Write A Pseudo Code For A Unit Converter. I Have Written The Program Already But I've Not Really Written One Before. It Converts Miles To KM:

Dim DataIn As Single
Dim DataOut As Single
Dim ConversionType As String
Const M2KCoefficient As Single = 1.6
Private Sub UserForm_Activate()
Call ResetParameters
End Sub
Sub ResetParameters()
'set the default conversion type
OptionButton1.Value = True
UserForm1.Caption = "Unit Convertor"
End Sub
Private Sub CommandButton1_Click()
Call ReadData
Call DetermineConversionType
Call ProcessData
Call OutputData
End Sub
Sub ReadData()
DataIn = Val(Txt_imput.Text)
End Sub
Sub DetermineConversionType()
If OptionButton1.Value = True Then
ConversionType = "km2miles"
ElseIf OptionButton2.Value = True Then
ConversionType = "miles2km"
End If
End Sub
Sub ProcessData()
Select Case ConversionType
Case "miles2km"
DataOut = DataIn * M2KCoefficient
Case "km2miles"
DataOut = DataIn / M2KCoefficient
End Select
End Sub
Sub OutputData()
Lbl_output.Caption = DataOut
End Sub


Pretty Easy, I Know, I Understand ALL OF THIS! BUT NOT HOW TO WRITE THAT PSEUDOCODE! PLEASE HELP!

Start with your application. What does it have to do? Then start by breaking it down into steps, for instance -

Convert Miles to Kilometers
multiply one mile by 0.123456 (sample!) to get one km.
Let user type in the value of the miles traveled.
Use the above multiplication to get the kilometers traveled.

As you said yourself above, you know what the code does. Now just break it down into human readability and not computer readability.

Have a look at the following link -

http://www.bigresource.com/Tracker/Track-vb-sjETRTxkP2/

This article has been dead for over six months. Start a new discussion instead.