Name: Date: ______ Computer Science 1/Computer Science 1

advertisement
Name: _________________________________________
Computer Science 1/Computer Science 1 HonorsMrs. Hillman
Date: ____________
Chapter 3 Review Exercises
1. A procedure needs to store the name of an item in inventory and its height and weight. The
height may have decimal places; the weight will be whole numbers only. Write the Dim
statements to create the necessary procedure-level variables.
2. Write an assignment statement that adds the contents of the sales1 variable to the contents
of the sales2 variable, and then assigns the sum to an existing variable named totalSales. All
of the variables have the Decimal data type.
3. Write an assignment statement that multiplies the contents of the salary variable by the
number 1.5, and then assigns the result to the salary variable. The salary variable has the
Decimal data type.
4. A form contains two buttons named salaryButton and bonusButton. Both buttons’ Click
event procedure need to use the same variable: a String variable named employeeName.
Write the statement to declare the employeeName variable. Also specify where you will
need to enter the statement and whether the variable is a procedure-level or module-level
variable.
5. Write the statement to declare a procedure-level named constant named Tax_Rate whose
value is .05. The named constant should have the Double data type.
6. Write the assignment statement to declare a module-level named constant named
Tax_Rate whose value is .05. The named constant should have the Decimal data type.
7. Write the statement to convert the contents of the unitsTextBox to an integer. Store the
integer in an Integer variable named numberOfUnits.
8. Write the statement to assign, to the unitsLabel, the contents of an Integer variable named
numberOfUnits.
9. Write the statement to assign, to a String variable, named totalSales, the sum of the values
stored in two Decimal variables named westSales and eastSales.
10. Write the statement to assign, to the payLabel, the value stored in a Decimal variable
named grossPay. The value should be displayed with a dollar sign and two decimal places.
Download