# Algorithm Workbench Essay

330 Words2 Pages
Short Answer 5 & 6 5. What two things must you normally specify in a variable declaration? You must specify type & name. 6. What value is stored in uninitialized variables? An uninitialized variable is by default a 0. Algorithm Workbench 3-10 3. Write assignment statements that perform the following operations with the variable a, b and c. a) Adds 2 to a and stores the result in b. { b = 2 + a } b) Multiplies b by 4 and stores the result in a. { a = b * 4} c) Divides a by 3.14 and stores the result in b. { b = a MOD 3.14 } d) Subtracts 8 from b and stores the result in a { a = 8 – b } 4. Assume the variables result, w, x, y and z are all integers, and that w=5, x=4, y=8 and z=2. What value will be stored in result in each of the following statements? a) 12 = x + y b) 4 = z * 2 c) 2 = y / x d) 6 = y – z 5. Write a pseudocode statement that declares the variable cost so it can hold a real numbers. Dim cost1 As Double = 0 6. Write pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Dim cost1 As Integer = 0 7. Write a pseudocode statement that assigns the value 27 to the variable count. Dim count As Integer = 27 8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total. Total = 10 + 14 9. Write a pseudocode statement that subtracts the variable downpayment from the variable total and assigns the result to the variable due. due = downpayment – total 10. Write a pseudocode statement that multiplies the variable subtotal by 0.15 and assigns the result to the variable totalfee. First you must make the variables real numbers. example.Dim subtotal As Double = 0 The statement asked for in the question will appear as totalfee = subtotal *