Question: I suppose to write a function in visual basic the receives three variables of type Double, representing the salary, bonus rate, and bonus amount, and
I suppose to write a function in visual basic the receives three variables of type Double, representing the salary, bonus rate, and bonus amount, and should calculate the bonus amount by multiplying the salary by the bonus rate. I wrote the function but I'm pretty sure it's wrong. Thanks in advance.
Public Class frmBonus Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click ' Variable declaration Dim Salary As Double = 5000 Dim BonusRate As Double = 0.075 Dim BonusAmount As Double CalculateBonus(Salary, BonusRate, BonusAmount) txtBonus.Text = BonusAmount.ToString("N2") End Sub Function CalculateBonus(Salary As Integer, BonusRate As Integer, BonusAmount As Integer) As Double Salary * BonusRate = BonusAmount Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Close the form. Me.Close() End Sub End Class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
