CS100M/CIS121/EAS121 Spring 2004 Lab 2 ------------------------------------------------------------------------------- 1) 12:20 only: Confirm people who should be there (Kelly will supply a list of students who should be there) 1:25 labs: Put 30 people in Blue Room. Take others to room TBA. Get list of people for each room. 2:30, 3:35: alert DIS if count exceeds 30 or so 2) Answer questions about Assignment questions from Chapter 1 and 2 3) Answer questions about selection statements (lecture on Tuesday) 4) Give reminders: - tokens: words in a language - statements: sentences in a language - the computer executes statements - a program is a collection of statements 5) Demonstration of statements not covered in lecture in detail: - MOD(X,Y): returns the remainder of x/y Note to Java people: Do NOT use "%"! - RAND: returns a random number in (0,1) 6) Problems to submit for Exercise 2: - Create a program called e2sol.m. - Write an appropriate comment block (include student name & id) - Write code that does the following: (a) prompts the user for an integer (store in x, assume legal input) (b) prompts the user for a 2nd integer (store in y, assume legal input) (c) displays the remainder of x/y. In a comment, explain why mod(3,4) would return 3 (d) demonstrates how to determine if x is even (e) finds help on FLOOR and CEIL (f) generates a random integer between 0 and 1 (inclusive) (g) generates a random integer between 0 and 100 (inclusive) (h) generates a random integer between 1 and 100 (inclusive) (i) generates a random integer between -10 and 10 (inclusive) In some comments, show the general pattern for generating a random integer using HIGH >= LOW, where both HIGH and LOW are integers -------------------------------------------------------------------------------