visual basic calling and returing functins
Write the code for a function named CalculateBonus. The function receives two decimal variables representing the salary and bonus rate. The function should calculate the bonus amount by multiplying the salary by the bonus rate, and then return the result. Then write the appropriate statement to invoke the function, passing it the decSalary and decRate variables. Assign the function’s return value to the decBonus variable.
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim decSalary As
Decimal = 10000
Dim decRate As Decimal =
15
Dim decBonus As
Decimal
decBonus = CalculateBonus(decSalary, decRate)
MessageBox.Show(decBonus)
End Sub
Public Function CalculateBonus(ByVal Salary
As Decimal, ByVal BonusRate As Decimal) As Decimal
Return Salary *
BonusRate / 100
End Function
End Class
Output:
Visual Studios Code view:
visual basic calling and returing functins Write the code for a function named CalculateBonus. The function...
Visual Basic: Write the code for a function named GetMajor. The function should prompt the user to enter a major field of study and then return the user’s response. Then write a statement to invoke the GetMajor function, returning the result to the strCurrentMajor variable.
25. (15 pes) Write the C++ code for a function that receives three double numbers. The function should calculate the average of the three numbers and them returm the result. Name the function conm Name the fornal parameters aumi, nu compAverage function. In addition, write a statement that invokes the compAverage f assigns its arguments: 14.50, 18.72, and S3.1 function and its return value to a double variable named answer. Use the following mumbers as the 26, (5 pts) Write...
answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...
can somebody help me with this please. This is for Visual Basic Write the code for an application that calculates the sum of two integer variables (intVar1, intVar2) and store it in a third integer variable (intSum). You should have two text boxes (txtVar1, txtVar2) and a label (lblSum) to show your result.
1. Write a statement that calls a function named showSquare, passing the value 10 as an argument. 2. Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int data type and areturn type of void. 3. Write the function prototype for a function called showScoreswith a parameter list containing four integer variables and a return type of void. 4. Look at the following function definition: double getGrossPay(int hoursWorked, double payRate)...
Python 3 code Write a function named coinflip that accepts an input called flips. The function should sim-ulate flipping a coin flips times. The function should return True if the coin was the same result for every flip. You can assume the function receives a positive integer as input. Write a second function named simulation that runs trials of the coin flip experiment. simulation should accept two parameters: the number of trials, and the number of coin flips to do...
Microsoft Visual Basic .VB Write a For Each loop that displays every element of an array named strSongNames in a ListBox named lstDisplay. The loop variable is named strPlay.
Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function that does the following: Prompts the user, using two input boxes, for the height and the radius of the base of a cone. Calls a function named cone_volume and passes the two values to it. Receives a value back from the function and displays it in a message to the user. Create a function named cone_volume that does the following: Receives the two values...
Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...
Help please: A Modular Function: You must rewrite the code to use a modular function that can be used again by other modules. Your main program will call the function and pass the variables by value. Your function will take the appropriate action and return the required value . (Hint you will use additional variables in your revised code). The called function must be able to accept the data passed to it by the function doing the calling. Only after...