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

(Tip, Tax, and Total) | Create a VB application that lets the user enter the amo

ID: 3756595 • Letter: #

Question

(Tip, Tax, and Total) | Create a VB application that lets the user enter the amount for food charge for a meal at a restaurant. The designer view should be as shown below. Tip, Tax, and Total Calculator | !! E x | a Amount Tp: Tax Total: Calcuiate Clear Egit 0 When the Calculate button is clicked, the application should calculate and display the amount of a 17.50% tip, 8.75% sales tax, and the total of all three amounts. If the user fails to enter numeric values, display an appropriate error message in a Status Strip and do not attempt to perform calculations..When the Clear button is clicked, the application should clear all the entries and set the focus to Amont.When the user clicks on Exit, the application should close

Explanation / Answer

Steps:
design form with 4 textboxes, 3 buttons

name four textboxes as txtAmt, txtTip, txtTax, txtTotal
name three buttons as btnExit, btnClear, btnCalc

set Enabled property of txtTip, txtTax, txtTotal as False

add StatusStrip control from toolbox to the form

add StatusLabel item to the StatusStrip keep name as it is ToolStripStatusLabel1
(right click StatusStrip >> Edit items)

Use following code

.

Public Class Form1

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        End
    End Sub

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        txtAmt.Text = ""
        txtTip.Text = ""
        txtTax.Text = ""
        txtTotal.Text = ""
        ToolStripStatusLabel1.Text = ""
        txtAmt.Focus()
    End Sub

    Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
        ToolStripStatusLabel1.Text = ""
        If Not IsNumeric(txtAmt.Text) Then
            ToolStripStatusLabel1.Text = "Please enter Amount..."
            txtAmt.Focus()
            Exit Sub
        End If


        txtTip.Text = Val(txtAmt.Text) * 17.5 / 100
        txtTax.Text = Val(txtAmt.Text) * 8.75 / 100

        txtTotal.Text = Val(txtAmt.Text) + Val(txtTip.Text) + Val(txtTax.Text)
    End Sub
End Class