Use input statements to get the requested items and store them in variables, the occupation should be stored in a string variable, the amount of the bill and the percentage could be in type decimal.
Write a sub procedure that accepts three arguments, namely the values input earlier, and display the person's occupation and the tip. You can calculate the tip by multiplying the bill amount and the percentage. If the bill comes to 50$ and the percentage is 15%, you would calculate 50*15/100=$7.50.
Post your pseudocode or your code for checking if you wish.
This questions is from Chapter 5, #54) Write a program to compute tips for services rendered. The program should request th person's occupation, the amount of the bill, and the percentage tip as input and pass this informaiton to a Sub procedure to display the person and the tip. I'm just little confused about what to do. Help!!
4 answers
This one is done, Than you so much MathMate, for solution it worked.
person occupation truck driver
amount of bill=$50
The tip =7.50
end sub
amount of bill=$50
The tip =7.50
end sub
Public Class frmGratuities
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
Dim amount As Double = CDbl(txtAmount.Text)
Dim percent As Double = CDbl(txtPercent.Text)
Dim occupation As String = (txtOccupation.Text)
txtTip.Text = "Tip the " & occupation & " " & (amount * (percent / 100)).ToString("c") & "."
End Sub
End Class
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
Dim amount As Double = CDbl(txtAmount.Text)
Dim percent As Double = CDbl(txtPercent.Text)
Dim occupation As String = (txtOccupation.Text)
txtTip.Text = "Tip the " & occupation & " " & (amount * (percent / 100)).ToString("c") & "."
End Sub
End Class