• Console.WriteLine AB has a problem with these links, you may be able to select, copy and paste in in your browser. Example The following code sample illustrates the use of WriteLine: [Visual Basic] Public Class TipCalculator Private Const tipRate As Double = 0.18 'Entry point which delegates to C-style main Private Function Public Overloads Shared Sub Main() System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs()) End Sub Overloads Public Shared Function Main(args() As String) As Integer Dim billTotal As Double If args.Length < 2 Then Console.WriteLine("usage: TIPCALC total") Return 1 Else Try billTotal = Double.Parse(args(1)) Catch Console.WriteLine("usage: TIPCALC total") Return 1 End Try Dim tip As Double = billTotal * tipRate Console.WriteLine() Console.WriteLine("Bill total:" + ControlChars.Tab + "{0,8:c}", billTotal) Console.WriteLine("Tip total/rate:" + ControlChars.Tab + "{0,8:c} ({1:p1})", tip, tipRate) Console.WriteLine("".PadRight(24, "-"c)) Console.WriteLine("Grand total:" + ControlChars.Tab + "{0,8:c}", billTotal + tip) Return 0 End If End Function 'Main End Class 'TipCalculator

Copyright 2018, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy