Vous êtes sur la page 1sur 3

Name: _______________________________________ Date: _____________ M. Riling Algebra 1 Programming Lesson 1 1. Do you have any experience programming?

? This includes even playing around with HTML online.

2. Open two windows on google chrome: First window: www.whsprogrammingclub.wordpress.com Second window: www.coffeescript.com. Size the windows so that they are side by side and you can see both at once.

In the coffeescript.org window, click the TRY COFFEESCRIPT tab. In the wordpress tab, click the Algebra 1 Lesson 1 entry. 3. Go through the slideshow on the blog page. a) What did you already know?

b) Name two things that you learned.

4. Copy/paste CODE A into coffeescipt. a) Delete the code in the coffeescript window. b) Paste in CODE A. c) Delete and re-type the quote marks. (They get messed up in the blog somehow.) d) Hit the gray Run button in the top right corner. e) Change the code so that it will say Hello, world! instead. What was the code?

f) Change the code to say anything you want it to say.

5. Copy/paste CODE B into coffeescript. NOTE: the lines that start with # are called comments. When the computer runs your program, it ignores all the comments. a) In what way does prompt( ) work differently than alert( )?

b) What happens when the computer runs #alert1?

c) Describe how #alert2 looks different from #alert1.

d) Describe what #alert2 does that is more advanced than #alert 1 when you run the program.

e) Now describe the difference between #alert3 and #alert4. Talk about both how the code is different, and how what happens when you run the program is different.

f) Change #alert5 and #alert6 so that these messages will pop up: You are ____ You are ____ years old. Please include the code you wrote here:

6. Clear all the code in the coffeescript window. a) Use a prompt to ask the user what school they go to. b) Use an alert to tell them that you go to _____, too. c) Write the code from your program here:

7. Clear the code and copy/paste CODE C into coffeescript. a) Notice that under #Find the sum, I did something before making an alert. What did I do? Why?

b) Add code under #Find the produce That is, fill in the rest of the b = line. c) Add code under #Find the difference That is, fill in the rest of the c = line. d) Now were going to get fancy. If I want to make the variable m equal to the square root of 25, I write: m = Math.sqrt(25) Under #Find the sum of the square roots, fill in the next two lines. sqRootOfx = ???? should find the square root of x sqRootOfy = ???? should find the square root of y e) More fanciness. If I want to make the computer do 35 and then store it as n, I write: n = Math.pow(3, 5) Under #Raise one number to the other one, fill in the next line. e = xy except using the Math.pow thing

8. Copy/paste CODE D. There are instructions in the comments. When you finish, copy/paste your code and make it a comment on the post! Dont forget to include your name.

Vous aimerez peut-être aussi