programming

write a program to calculate the amount of a server's tip given the amount of the bill and the percentage tip ovtained via input dialog boxes. The output should be a complete sentence that reiterates the inputs and gives the resulting tip. here is my attempt: Public Class frmTip Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click Dim billAmount As Double Dim percent, tip As Double billAmount = CDbl(InputBox("Amount of Bill")) percent = CDbl(InputBox("Amount of Tip")) tip = billAmount * percent / 100 txtOutput.Text = CDbl(Math.Round(tip, 2)) txtOutput.Text = "A percent tip on bill is tip" End Sub End Class

Answers

This program calculates the amount of a server's tip by taking the amount of the bill and the percentage tip obtained via input dialog boxes. The output is a sentence that reiterates the inputs and gives the resulting tip. The program first obtains the inputs (the bill amount and the percentage tip) via the InputBox() function, assigns them to variables (billAmount and percent, respectively), and calculates the tip by multiplying the billAmount by the percent and dividing by 100. The result is then rounded to two decimal places with Math.Round(). Finally, the output is formatted as a sentence with the calculated amount of tip inserted into it.

Answered by bcruz

We have mentors from

Contact support