Deck 3: Using Variables and Constants

Full screen (f)
exit full mode
Question
All numeric variables are automatically initialized to 0 if no initial value is specified when the variable is declared.
Use Space or
up arrow
down arrow
to flip the card.
Question
A Boolean variable is initialized to the value True if no initial value is stated when the variable is declared.
Question
Spaces are allowed in variable names.
Question
Instead of storing data in the properties of various controls,programmers can create ____,which are memory locations inside the computer,to store data.

A)characters
B)variables
C)integers
D)strings
Question
Object and String variables are automatically initialized using ____.

A)spaces
B)the keyword Nothing (no data at all)
C)the word "Nothing"
D)0
Question
Every numeric data type in Visual Basic has a ____ method that can be used to convert a string to that numeric data type.

A)Convert
B)Format
C)TryParse
D)Number
Question
You can eliminate the problems that occur as a result of implicit type conversions by entering the Option Explicit On statement in the General Declarations section of the Code Editor window.
Question
Data types and classes are not related to each other.
Question
Which of the following statements declares a Double variable named dblAverage?

A)Dim dblAverage As Double
B)Dim As Double dblAverage
C)Const dblAverage As Constant
D)Dim dblAverage As Single
Question
Calculations involving Decimal variables are not subject to the small rounding errors that may occur when using Double or Single variables.
Question
The assignment operator in Visual Basic is the ____ symbol.

A)^
B)<
C)>
D)=
Question
A named constant's value cannot be changed while the application is running.
Question
A variable declared in the Declaration section of a form is called a procedure-level variable.
Question
You cannot associate a procedure with more than one object or event.
Question
A memory variable that is a Double data type requires ____ bytes of storage.

A)2
B)4
C)6
D)8
Question
Which of the following statements subtracts the contents of the intNum1 variable from the contents of the intNum2 variable,and then multiples the difference by 3? The result is assigned to the intResult variable.

A)intNum1 - intNum2 * 3 = intResult
B)(intNum2 - intNum1) * 3 = intResult
C)intResult = (intNum1 - intNum2) * 3
D)intResult = (intNum2 - intNum1) * 3
Question
A variable name must begin with a letter or a(n)____.

A)ampersand (&)
B)percent sign (%)
C)exclamation mark (!)
D)underscore (_)
Question
Which of the following can store a number containing a decimal place?

A)Single
B)Long
C)String
D)Integer
Question
The value returned by the InputBox function depends on the button the user chooses.
Question
Date variables are automatically set to which value when created?

A)1/1/1980 12:00:00 AM
B)1/1/2000 12:00:00 AM
C)1/1/0001 12:00:00 AM
D)1/1/0000 12:00:00 AM
Question
You declare a class-level variable using the ____ keyword.

A)Dim
B)Mod
C)Private
D)Static
Question
The ____ clause in an event procedure's header indicates the object and event associated with the procedure.

A)Handles
B)Private
C)Local
D)Associate
Question
You create a named constant using the ____ statement.

A)Fixed
B)Const
C)ConstantFixed
D)Perm
Question
The pet's temperature is recorded at every visit,and it may contain a decimal place.What data type is best for storing this data?

A)String
B)Integer
C)Decimal
D)Double
Question
A variable that was not assigned a specific data type is assigned the ____ data type.

A)Char
B)String
C)Boolean
D)Object
Question
When a button is selected,the computer processes the code contained in the button's ____ event procedure.

A)Submit
B)Press
C)On
D)Click
Question
Which of the following statements formats the contents of the dblPay variable with a dollar sign and no decimal places?

A)lblPay.Text = dblPay.ToString("C2")
B)lblPay.Text = dblPay.ToString(C0)
C)lblPay.Text = dblPay.ToCurrency("C0")
D)lblPay.Text = dblPay.ToString("C0")
Question
When using the Visual Basic 2015 InputBox function,which of the following is the Windows standard?

A)sentence capitalization for both the prompt and the title
B)book title capitalization for the title and sentence capitalization for the prompt
C)book title capitalization for both the prompt and the title
D)Pascal case for both the prompt and the title
Question
You use the ____ operator to concatenate strings together.

A)@
B)%
C)&
D)#
Question
A control's ____ event occurs when a change is made to the contents of a control's Text property.

A)CodeChanged
B)TextChanged
C)ChangedText
D)TextModified
Question
Which of the following statements declares a class-level variable?

A)Private Dim dblHeight As Double
B)Dim dblHeight As Double
C)Class dblHeight As Double
D)Private dblHeight As Double
Question
The strFirstName and strLastName variables contain the strings "Jane" and "Jones",respectively.Which of the following statements will display a string as "Jones,Jane" (the last name,a comma,a space,and the first name)in the lblFullName control?

A)lblFullName = strLastName, & strFirstName
B)lblFullName = strLastName & ", " strFirstName
C)lblFullName = strLastName & ", " & strFirstName
D)none of the above
Question
A form's CancelButton property specifies the button whose Click event procedure is processed when the user presses the ____ key.

A)Enter
B)Shift
C)Tab
D)Esc
Question
The line continuation character is a(n)____.

A)ampersand (&)
B)underscore (_)
C)equal sign (=)
D)pound sign (#)
Question
Specifying the number of decimal places and the special characters to display in a number is called ____.

A)formatting
B)concatenating
C)shredding
D)designing
Question
The data entered by the users is currently stored in properties of controls of the form.Your first task to improve the application is to ____.

A)declare variables for all of the input data
B)rename the controls
C)change the layout of the form
D)add a colorful logo to the form
Question
The ____ of a variable determines where in the application's code a variable can be used.

A)dimension
B)type
C)scope
D)extent
Question
The ControlChars.NewLine constant instructs the computer to ____.

A)advance the insertion point to the next line in a control
B)exit the routine and restart
C)restart from the beginning of the subroutine
D)strip the remainder of the routine
Question
If Option Strict is set to On,which of the following statements will assign the contents of the txtLateFee control to a Decimal variable named decLateFee?

A)TryParse.Decimal(txtLateFee.Text, decLateFee)
B)Decimal.TryParse(txtLateFee.Text, decLateFee)
C)decLateFee = Convert.ToDecimal(txtLateFee)
D)decLateFee = txtLateFee.Text
Question
A default button is identified by setting the form's ____ property.

A)AcceptButton
B)DefaultButton
C)SelectedButton
D)CancelButton
Question
A local gym needs an application to apply a 10% discount for all new members who present a coupon during enrollment.Write the statements to declare a variable to record if a customer has a coupon,and to assign the discount rate.The discount rate will not change while the application is running.
Question
Write a statement to display an input dialog box that shows "Car Make:" as the prompt,"Car" in the title bar,and an empty input area.When the user closes the dialog box,the assignment statement assigns the function's return value to the strCar variable.
Question
The decBalance variable contains the number 1368.52.Write the assignment statement to display the value with a dollar sign,a thousands separator,and two decimal places in the lblBalance control.
Question
A procedure in an application needs to store data used to calculate the total price of purchasing tires.The price of the tires will contain a decimal place.The number of tires will always be a whole number.Write the appropriate Dim statements to declare the variables.Make sure to use appropriate naming conventions.
Question
An application allows a user to enter an item price and a quantity to be used in a calculation.The item price may contain a decimal place,and the quantity will always be a whole number.Write the appropriate Dim statements to declare the variables.Write the related statements needed to convert the strings entered by the user into numeric data types.
Question
A procedure in an application needs to store student data.The student first name,student last name,student GPA,and whether or not the student is registered all need to be stored.Write the appropriate Dim statements to declare the variables.Make sure to use appropriate naming conventions.
Question
The account number for each pet must be available to be used by all procedures in the form.You should make sure the account number is declared using the ____ keyword.

A)Public
B)Dim
C)Private
D)Val
Question
What are the Convert class methods and why are they sometimes used instead of conversion functions?
Question
The veterinarian wants to document and display the name of the technician who performs the initial evaluation of the pet.You decide to use an InputBox function to prompt the user to enter this data first.The InputBox function should be coded in the ____.

A)Save button's Click event procedure
B)form's Load event procedure
C)Print button's Click event procedure
D)Exit button's Click event procedure
Question
What is a static variable? How is it different from a class-level variable?
Question
Explain the scope and lifetime of variables.How are a variable's scope and lifetime determined? List the three scopes available for a variable.
Question
To simplify the coding of the InputBox function,the prompt and the title for the InputBox can be declared as ____ because they will not change while the application runs.

A)string variables
B)static variables
C)Boolean variables
D)named constants
Question
A procedure in an application needs to store tax rate data.The county of residence and the tax rate need to be stored.Write the appropriate Dim statements to declare the variables.Write an assignment statement that assigns .08 to the tax rate variable.
Question
What is a TextChanged event? How can it be used within an application?
Question
An application allows a user to enter an employee code,a salary amount,and a bonus rate to be used in a calculation.The salary amount will always be a whole number,and the bonus rate may contain a decimal place.Write the appropriate Dim statements to declare the variables.Write the related statements needed to convert the strings entered by the user into numeric data types.
Question
The Decimal,Double,and Single variable data types can all store what type of numeric data? Explain the differences among these three data types and problems that can occur with their use.
Question
The decRate variable contains the number .03.Write the assignment statement to display the value as 3% in the lblRate control.
Question
Dim strPROMPT As String = "Please enter an employee code:"
Const strTITLE As String = Employee Data
'assign the code to a variable
strCode = InputBox(strTITLE,strPROMPT)
Question
Private Sub btnCalc_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnCalc.Click
' calculates and displays the total amount owed for purchasing hats
' user enters number of hats and price per hat
' all hats are on sale for 25% off the price
Dim dblNumHats As Integer
Dim decHatPrice As Decimal
Dim decDiscount As Double
Dim decTotal As Decimal
' assign number of hats and price to variables
Integer.TryPurse(txtNumHats.Text,intNumHats)
Decimal.TryParse(txtHatPrice,decHatPrice)
' calculate and display the total amount owed
decDiscount = decHatPrice * dblRATE
decTotal = (intNumHats + decHatPrice)- decDiscount
Total.Text = decTotal.ToString(C2)
End Sub
Question
An application translates English words into French words and displays the results as a message in a Label control.The strEnglish variable contains the string "apple".The strFrench variable contains the string "pomme".Write an assignment statement to display the string "The French word for apple is pomme." in the lblMessage control.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Using Variables and Constants
1
All numeric variables are automatically initialized to 0 if no initial value is specified when the variable is declared.
True
2
A Boolean variable is initialized to the value True if no initial value is stated when the variable is declared.
False
3
Spaces are allowed in variable names.
False
4
Instead of storing data in the properties of various controls,programmers can create ____,which are memory locations inside the computer,to store data.

A)characters
B)variables
C)integers
D)strings
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
5
Object and String variables are automatically initialized using ____.

A)spaces
B)the keyword Nothing (no data at all)
C)the word "Nothing"
D)0
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
6
Every numeric data type in Visual Basic has a ____ method that can be used to convert a string to that numeric data type.

A)Convert
B)Format
C)TryParse
D)Number
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
7
You can eliminate the problems that occur as a result of implicit type conversions by entering the Option Explicit On statement in the General Declarations section of the Code Editor window.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
8
Data types and classes are not related to each other.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following statements declares a Double variable named dblAverage?

A)Dim dblAverage As Double
B)Dim As Double dblAverage
C)Const dblAverage As Constant
D)Dim dblAverage As Single
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
10
Calculations involving Decimal variables are not subject to the small rounding errors that may occur when using Double or Single variables.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
11
The assignment operator in Visual Basic is the ____ symbol.

A)^
B)<
C)>
D)=
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
12
A named constant's value cannot be changed while the application is running.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
13
A variable declared in the Declaration section of a form is called a procedure-level variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
14
You cannot associate a procedure with more than one object or event.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
15
A memory variable that is a Double data type requires ____ bytes of storage.

A)2
B)4
C)6
D)8
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following statements subtracts the contents of the intNum1 variable from the contents of the intNum2 variable,and then multiples the difference by 3? The result is assigned to the intResult variable.

A)intNum1 - intNum2 * 3 = intResult
B)(intNum2 - intNum1) * 3 = intResult
C)intResult = (intNum1 - intNum2) * 3
D)intResult = (intNum2 - intNum1) * 3
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
17
A variable name must begin with a letter or a(n)____.

A)ampersand (&)
B)percent sign (%)
C)exclamation mark (!)
D)underscore (_)
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
18
Which of the following can store a number containing a decimal place?

A)Single
B)Long
C)String
D)Integer
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
19
The value returned by the InputBox function depends on the button the user chooses.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
20
Date variables are automatically set to which value when created?

A)1/1/1980 12:00:00 AM
B)1/1/2000 12:00:00 AM
C)1/1/0001 12:00:00 AM
D)1/1/0000 12:00:00 AM
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
21
You declare a class-level variable using the ____ keyword.

A)Dim
B)Mod
C)Private
D)Static
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
22
The ____ clause in an event procedure's header indicates the object and event associated with the procedure.

A)Handles
B)Private
C)Local
D)Associate
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
23
You create a named constant using the ____ statement.

A)Fixed
B)Const
C)ConstantFixed
D)Perm
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
24
The pet's temperature is recorded at every visit,and it may contain a decimal place.What data type is best for storing this data?

A)String
B)Integer
C)Decimal
D)Double
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
25
A variable that was not assigned a specific data type is assigned the ____ data type.

A)Char
B)String
C)Boolean
D)Object
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
26
When a button is selected,the computer processes the code contained in the button's ____ event procedure.

A)Submit
B)Press
C)On
D)Click
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following statements formats the contents of the dblPay variable with a dollar sign and no decimal places?

A)lblPay.Text = dblPay.ToString("C2")
B)lblPay.Text = dblPay.ToString(C0)
C)lblPay.Text = dblPay.ToCurrency("C0")
D)lblPay.Text = dblPay.ToString("C0")
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
28
When using the Visual Basic 2015 InputBox function,which of the following is the Windows standard?

A)sentence capitalization for both the prompt and the title
B)book title capitalization for the title and sentence capitalization for the prompt
C)book title capitalization for both the prompt and the title
D)Pascal case for both the prompt and the title
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
29
You use the ____ operator to concatenate strings together.

A)@
B)%
C)&
D)#
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
30
A control's ____ event occurs when a change is made to the contents of a control's Text property.

A)CodeChanged
B)TextChanged
C)ChangedText
D)TextModified
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements declares a class-level variable?

A)Private Dim dblHeight As Double
B)Dim dblHeight As Double
C)Class dblHeight As Double
D)Private dblHeight As Double
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
32
The strFirstName and strLastName variables contain the strings "Jane" and "Jones",respectively.Which of the following statements will display a string as "Jones,Jane" (the last name,a comma,a space,and the first name)in the lblFullName control?

A)lblFullName = strLastName, & strFirstName
B)lblFullName = strLastName & ", " strFirstName
C)lblFullName = strLastName & ", " & strFirstName
D)none of the above
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
33
A form's CancelButton property specifies the button whose Click event procedure is processed when the user presses the ____ key.

A)Enter
B)Shift
C)Tab
D)Esc
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
34
The line continuation character is a(n)____.

A)ampersand (&)
B)underscore (_)
C)equal sign (=)
D)pound sign (#)
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
35
Specifying the number of decimal places and the special characters to display in a number is called ____.

A)formatting
B)concatenating
C)shredding
D)designing
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
36
The data entered by the users is currently stored in properties of controls of the form.Your first task to improve the application is to ____.

A)declare variables for all of the input data
B)rename the controls
C)change the layout of the form
D)add a colorful logo to the form
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
37
The ____ of a variable determines where in the application's code a variable can be used.

A)dimension
B)type
C)scope
D)extent
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
38
The ControlChars.NewLine constant instructs the computer to ____.

A)advance the insertion point to the next line in a control
B)exit the routine and restart
C)restart from the beginning of the subroutine
D)strip the remainder of the routine
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
39
If Option Strict is set to On,which of the following statements will assign the contents of the txtLateFee control to a Decimal variable named decLateFee?

A)TryParse.Decimal(txtLateFee.Text, decLateFee)
B)Decimal.TryParse(txtLateFee.Text, decLateFee)
C)decLateFee = Convert.ToDecimal(txtLateFee)
D)decLateFee = txtLateFee.Text
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
40
A default button is identified by setting the form's ____ property.

A)AcceptButton
B)DefaultButton
C)SelectedButton
D)CancelButton
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
41
A local gym needs an application to apply a 10% discount for all new members who present a coupon during enrollment.Write the statements to declare a variable to record if a customer has a coupon,and to assign the discount rate.The discount rate will not change while the application is running.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
42
Write a statement to display an input dialog box that shows "Car Make:" as the prompt,"Car" in the title bar,and an empty input area.When the user closes the dialog box,the assignment statement assigns the function's return value to the strCar variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
43
The decBalance variable contains the number 1368.52.Write the assignment statement to display the value with a dollar sign,a thousands separator,and two decimal places in the lblBalance control.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
44
A procedure in an application needs to store data used to calculate the total price of purchasing tires.The price of the tires will contain a decimal place.The number of tires will always be a whole number.Write the appropriate Dim statements to declare the variables.Make sure to use appropriate naming conventions.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
45
An application allows a user to enter an item price and a quantity to be used in a calculation.The item price may contain a decimal place,and the quantity will always be a whole number.Write the appropriate Dim statements to declare the variables.Write the related statements needed to convert the strings entered by the user into numeric data types.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
46
A procedure in an application needs to store student data.The student first name,student last name,student GPA,and whether or not the student is registered all need to be stored.Write the appropriate Dim statements to declare the variables.Make sure to use appropriate naming conventions.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
47
The account number for each pet must be available to be used by all procedures in the form.You should make sure the account number is declared using the ____ keyword.

A)Public
B)Dim
C)Private
D)Val
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
48
What are the Convert class methods and why are they sometimes used instead of conversion functions?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
49
The veterinarian wants to document and display the name of the technician who performs the initial evaluation of the pet.You decide to use an InputBox function to prompt the user to enter this data first.The InputBox function should be coded in the ____.

A)Save button's Click event procedure
B)form's Load event procedure
C)Print button's Click event procedure
D)Exit button's Click event procedure
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
50
What is a static variable? How is it different from a class-level variable?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
51
Explain the scope and lifetime of variables.How are a variable's scope and lifetime determined? List the three scopes available for a variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
52
To simplify the coding of the InputBox function,the prompt and the title for the InputBox can be declared as ____ because they will not change while the application runs.

A)string variables
B)static variables
C)Boolean variables
D)named constants
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
53
A procedure in an application needs to store tax rate data.The county of residence and the tax rate need to be stored.Write the appropriate Dim statements to declare the variables.Write an assignment statement that assigns .08 to the tax rate variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
54
What is a TextChanged event? How can it be used within an application?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
55
An application allows a user to enter an employee code,a salary amount,and a bonus rate to be used in a calculation.The salary amount will always be a whole number,and the bonus rate may contain a decimal place.Write the appropriate Dim statements to declare the variables.Write the related statements needed to convert the strings entered by the user into numeric data types.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
56
The Decimal,Double,and Single variable data types can all store what type of numeric data? Explain the differences among these three data types and problems that can occur with their use.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
57
The decRate variable contains the number .03.Write the assignment statement to display the value as 3% in the lblRate control.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
58
Dim strPROMPT As String = "Please enter an employee code:"
Const strTITLE As String = Employee Data
'assign the code to a variable
strCode = InputBox(strTITLE,strPROMPT)
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
59
Private Sub btnCalc_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnCalc.Click
' calculates and displays the total amount owed for purchasing hats
' user enters number of hats and price per hat
' all hats are on sale for 25% off the price
Dim dblNumHats As Integer
Dim decHatPrice As Decimal
Dim decDiscount As Double
Dim decTotal As Decimal
' assign number of hats and price to variables
Integer.TryPurse(txtNumHats.Text,intNumHats)
Decimal.TryParse(txtHatPrice,decHatPrice)
' calculate and display the total amount owed
decDiscount = decHatPrice * dblRATE
decTotal = (intNumHats + decHatPrice)- decDiscount
Total.Text = decTotal.ToString(C2)
End Sub
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
60
An application translates English words into French words and displays the results as a message in a Label control.The strEnglish variable contains the string "apple".The strFrench variable contains the string "pomme".Write an assignment statement to display the string "The French word for apple is pomme." in the lblMessage control.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 60 flashcards in this deck.