Correction to the PDF

There is a small error in the PDF this week. The pseudo-code returns the value false when the value is less than 17. The pseudo-code should return the value true when the value is less than 17 and false when the value is greater than or equal to 17. The error is only in the pseudo-code and does not exist anywhere else in the PDF or the code files.

Join Your Team

Each week, you will be assigned a new team to work with. Find your new team (your TA should have posted your team assignment) and introduce yourself to them!

Seating arrangement for this week are here.

Lab Assignment

Your TA should have distributed a print-out of the lab assignment. If you did not get one when you came in, you should ask your TA for one.

If you prefer, you can also view the PDF here.

File Download

Click here to download the files you will use for this lab.

Getting Into a Plain Text Editor

One of the most popular, easy-to-use text editors is a free editor called Notepad++. This program is already on the lab computers! You can find it by clicking Start, then All Programs, then Word Processing, and finally Notepad++.

Once Notepad++ is open, you can use File -> Open to open your JavaScript file you have extracted from the ZIP or you can simply drag the file from Windows into Notepad++.

Cheat Sheet

Examples of Statements
Statements always end in a semicolon
___________________;
x = x + 1;
var orange = 4;

Examples of Variables
var n;
var a = 0;
a = a + 1;

Examples of a Conditional
if (x < 3)
{
...statements go inside the braces...
}

Examples of Booleans
n < 3
n > 3
n == 3
n != 3

Examples of a Function
function name(p1, p2)
{
...statements go inside the braces...
   return ___________________;
}

Examples of a Loop
while (x < 3)
{
...statements go inside the braces...
}

Examples of a for loop
for (var i = 0; i < 10; i++)
{
...statements go inside the braces...
}

Examples of Strings
var s = "Hello";
var c = s.charAt(1); // c now contains "e"

var len = s.length; // len is now 5
Examples of a loop w/ strings
var s = "something";
for (var i = 0; i < s.length; i++)
{
   var c = s.charAt(i);
   ...
}

Something didn't work?

Your JavaScript should work in any browser, but some browsers are designed to be focused on developing a web page as much as they are on viewing a web page. Internet Explorer, the default browser on most systems, does not come with any included debugging tools.

The first thing to try is to try any browser except Internet Explorer. To open your file in that other browser, you should right click the HTML file and hover over Open with. Once the pop-up menu shows up, choose either Firefox or Chrome.

If your code does not work with both browsers -- something is wrong! Check to make sure everything is spelled correct, the capitalization of your variables are the same in every place, and that you have declared all of your variables.

Upload Your Work

Once you have completed all three JavaScript functions, you and everyone in your team need to upload your lab to get credit. Upload your solution here! Your JavaScript file will have a file extension of .js, make sure your upload the correct file or you will not get credit. If you make multiple submissions, we will consider your last submission the one we use for grading.

Remember, the TA will randomly grade one of the submissions from your group and your grade will be based on that submissions. You should double check and help out your team members finish up the lab. Once you and all your team members are finished with the lab, you are done — until next week!

CS 105 (Spring 2014): Introduction to Computing