Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Open the VB2015\\Chap03\\Bonus Solution\\Bonus Solution (Bonus Solution.sln) fil

ID: 3682085 • Letter: O

Question

Open the VB2015Chap03Bonus SolutionBonus Solution (Bonus Solution.sln) file. The application displays a salesperson's total sales and bonus amounts. The bonus is calculated by multiplying the total sales by 10%. make the Calculate button the default button. Open the Code Editor window and enter your name, the current date, and the three Option statements in the General Declarations section. Code the application using variables, a named constant for the bonus rate, and the TryParse and ToString methods. Display the total sales and bonus amounts with a dollar sign, two decimal places, and a thousands separator (if appropriate). Save the solution and then start the application. Test the application by calculating the bonus for a salesperson whose sales are $2000, $4550.89, and $5650.99.

Explanation / Answer

Declare local variables with the Dim statement and module-level variables with the Private statement.

o   Specifying an initial value for a variable is optional -- do so if necessary.

o   If an initial value is not assigned, then a string stores the "empty string" and all numeric variable types store the value zero.

Dim bonus as Float
Dim sales name as Float
Dim isconverted as Boolean
isConverted = Decimal.Tryprase(textboxname)

sales1 = content
sales2 = content
totalSales = sales1 + sales2

Label1.Text = totalSales

Dim unitsenter As String
Dim numberofunits As Integer
Dim isConverted As Boolean

unitsenter = unitsTextBox.Text
isConverted = Integer.TryParse(unitsenter, numberofunits)