Create an application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the application should calculate and display the amount of a 15 percent tip, 7 percent sales tax, and the total of all three amounts.

Respuesta :

ijeggs

Answer:

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

       Dim foodCharge, tax, tip, totalCharge As Double

       foodCharge = Val(TextBox1.Text)

       tax = 0.07 * foodCharge

       tip = 0.15 * 100

       totalCharge = foodCharge + tax + tip

       Label5.Text = tax

       Label6.Text = tip

       Label7.Text = totalCharge

   End Sub

End Class

Explanation:

  1. This is implemented using Visual Basic programming language
  2. Firstly we declared all the variables using DIM key word
  3. Then the calculation for each variable is done according to the specification of the question
  4. On the form (See attached Image) the controls for receiving the user input is created as well as the controls for the output.
  5. See the attached sample run below:

Ver imagen ijeggs