Name: Student ID: Section: ----------------------------------------------------------------------- This lab is worth 15 points. Do the problems below and submit online by Monday, 2/2/2009, 11:59 PM (see link on calendar page). If you get stuck on the problems, feel free to ask someone else for help, but, remember, no copying! ----------------------------------------------------------------------- For problems 1-3 below, state what the computer "knows" at every line after the line has been executed. Example: Computer knows -------------- var x; x: ? var z, y = 3; x: ?, z: ?, y: 3 x = 1; x: 1, z: ?, y: 3 y = y + x; x: 1, z: ?, y: 4 1. Computer knows -------------- var foo = 4; foo = foo + 1; var bar = foo; bar = 3; bar = 3 * bar; foo = bar; 2. Computer knows -------------- var alpha = 1, beta; var gamma = 2; alpha = alpha / gamma; beta = alpha * -2; gamma = gamma + gamma; alpha = beta + gamma; alpha = alpha; 3. Computer knows -------------- var alpha = 0; var x, y, z; x = alpha + alpha; y = x; x = -1; For problems 4-6 below, write the sequence of statements that will accomplish the required task. Make sure all identifiers are meaningful. Example: The price of a 14 ounce box of cereal is $5.39. Compute the cost per ounce. Save that value in a variable called unitPrice. var weight = 14; var cost = 5.39; var unitPrice = cost / weight; 4. Alice is 21 years old. Bob is 20 years old. Cynthia is 18 years old. How old are they all together? Create one variable per person's age. 5. You submitted 5 homeworks for a particular course with scores of 9, 8, 10, 7, 10. What is your average score? Create variables for each assignment and then compute the average. 6. Compute the number of seconds in a day. Create the following variables: secondsPerMinute, minutesPerHour, and hoursPerDay. Save that value in a variable called secondsPerDay.