Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started