Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Determine the output displayed in the list box by the lines of code. Dim tax

ID: 3641379 • Letter: 1

Question

1. Determine the output displayed in the list box by the lines of code.
Dim tax As Double
tax = 200
tax = 25 + tax
lstOutput.Items.Add(tax)
2. Find the value of the given function where a and b are numeric variables of type Double, a = 5 and b = 3.
Math.Round(a/b)
3. Determine the output displayed in the list box by the lines of code.
Dim m As Integer = 4
Dim n As Integer = 3
Dim s As String = "Microsoft"
Dim t As String = "soft"
lstOutput.Items.Add(s.Length)
lstOutput.Items.Add(s.ToLower)
lstOutput.Items.Add(s.Substring(m, n - 1))
lstOutput.Items.Add(s.IndexOf(t))
4. Identify any errors.
Dim hiyo As String
hiyo = "Silver"
txtBox = "Hi-Yo " & hiYo
5. Determine the output produced by the lines of code.
Const SALES_TAX_RATE As Double = 0.06
Dim price as Double = 100
Dim cost = (1 + SALES_TAX_RATE) * price
txtOutput.Text = FormatCurrency(cost)
6. Identify any errors.
txtOutput.Text = FormatCurrency($1234)
7. Write a program that asks for the amount of the bill and percentage tip and calculates the tip. The program should use variables for each of the quantities and display the outcome in a text box with a label. Test the program on a bill of $20 and a 15% tip.

Explanation / Answer

Ans 1 .

     225
Ans 2.

2
(5/3=1.666, nearest integer is 2)

Ans 3.

9
   microsoft
   os
   5

(letters in MS, lowercase of microsoft, (start to left of 4th letter ie, r and pick "os", 2 letters)

the number of letters in microsoft, left of which soft starts Indexof() yields position, so s.indexof(t) counts a position to left of which t starts and that is 5.

  

Ans 4.
txtBox.text = "Hi-Yo " &hiyo
2 mistakes in name of variable (following &) and in assigning an object to a characteristic.

msgbox= is a constructor, but the same does not hold for textboxes in general.
Ans 5.

On the local computer based on local location settings based en-US, $106.00. Which comes in formatting currency default settings. If local time settings were different and set, currency would be local currency.
If the location were uk the pounds symbol would follow, if it were india, Rs. Would preeceed.

Ans 6.
$ is an invalid input, as formatcurrency expects numeric input.
Solution(Use the following in code instead):

Const cost As Double = 1234

        txtOutput.Text = cost.ToString("c", New Globalization.CultureInfo("en-US", False))

Ans 7.

Public Class Form1

Private Sub Computellizone_Click(sender As Object, e As EventArgs) Handles Compute.Click

        Dim Coded, Dalpha, c As Double

        Coded = Convert.ToDouble(TxtBoxer1.Text)

        Dalpha = Convert.ToDouble(TxtBonn.Text)
'the txtboxer1 and the follower were name of 2 text boxes.

        c = Coded * Dalpha / 100

        txtOutput.Text =c.ToString("c", New Globalization.CultureInfo("en-US", False))

    End Sub

End Class


Output $3.00