# Unit 3 Assignment 1

328 Words2 Pages
Alpha Arnold PT1420 – Morning Feb 15, 2014 Unit 3 Assignment 1: Homework Short answers: 5. What two things must you normally specify in a variable declaration? You must specify the variable type and an identifier. 6. What value is stored in uninitialized variables? Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values. Algorithm Workbench 3. Write assignment statements that perform the following operations with the variables a,b,c A. set b=a+2 B. set a=b*2 C. set b=a/3.14 D. set a=b-8 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 in of the following statements? A. Set result = 4+8 B. Set result = 2*2 C. Set result = 8/4 D. Set result = 8-2 5. Write a pseudcode statement that declares the variable cost so it can hold real numbers. Dim cost1 As Double = 0 6. Write a 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 10 and 14 to the variable total /*Declare variables Total=0 A=10 B=14 Begin Total=A+B end 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 .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 =