Rounding Currency
Many of my friends at University has request me to post the homework code of Vb.net that I have done on my blog. and here the simple Vb.net Console Application that i’m learning at University. So I hope that younger or older brother that learning in IT can see the simple code and correct or implement it together.
-The Code are focus on how to use “IF Condition” and “Do Loop”.
Here is the Rounding Currency Code In VB.net Console Application
Module Module1
Sub Main()
Dim ROUND As Double
Dim amount As Double
Dim selected As Integer
Dim modulus As Double
Dim yesno As StringDo
Console.Clear()
Console.WriteLine(”Rounding Currency Table”)
Console.WriteLine(”1.RIEL”)
Console.WriteLine(”2.USD”)
Console.WriteLine(”3.EURO”)
Console.WriteLine(”4.POUND”)
Console.WriteLine(”Please Select the Currency”)
selected = Console.ReadLineIf (selected = 1) Then
Console.Clear()
Console.WriteLine(”1.RIEL”)
Console.WriteLine(”Input Amount:”)
amount = Console.ReadLine
modulus = amount Mod 100If (modulus = 50) Then
ROUND = amount
ElseIf (modulus > 50) Then
ROUND = (amount - modulus) + 100
ElseIf (modulus < 50) Then
ROUND = amount - modulus
End If
Console.WriteLine(”Rounded Amount={0}Riel”, ROUND)
ElseIf (selected = 2) Then
Console.Clear()
Console.WriteLine(”2.USD”)
Console.WriteLine(”Input Amount”)
amount = Console.ReadLine
Console.WriteLine(”Rounded Amount={0} USD”, amount)
ElseIf (selected = 3) Then
Console.Clear()
Console.WriteLine(”3.EURO”)
Console.WriteLine(”Input Amount”)
amount = Console.ReadLine
Console.WriteLine(”Rounded Amount={0} EURO”, amount)
ElseIf (selected = 4) Then
Console.Clear()
Console.WriteLine(”4.POUND”)
Console.WriteLine(”Input Amount”)
amount = Console.ReadLine
Console.WriteLine(”Rounded Amount={0} POUND”, amount)
Else
Console.WriteLine(”Wrong Selection”)
End If
Console.WriteLine(”Do you want to continue (Y|N)? “)
yesno = Console.ReadLineLoop Until (yesno = “n”)
End Sub
End Module
If you have any problem of running the program or need to ask inside code, please fill free to ask me. I might be available from my best tried.
Posted in VB.net Tagged: VB.net
Written by Myhouse on December 1st, 2008 with no comments.
Read more articles on VB.net and otherSoftware.
Today, the 















