## CS 21a Introduction to Computing I 1st Semester, 2006-2007 John Paul Vergara, PhD

Moodle

### Announcements

• Your handson grades should be available via moodle. An optional third handson exam will be given on Friday, 13 October. One handson exam will be cancelled, so if you choose to not take the handson on Friday, that will be the cancelled handson. This also means that if you have a low handson grade in the first two exams, I suggest that you take the coming exam. Coverage will be on loops, arrays, and console input; refer to Lab 4 below for an example. Time of handson: 1130-130 for Section B, 130-330 for Section C.
• Mouse Listener Demo
• Sample Handson Exam on Applets
• Object arrays: Class List example and Phone Book example discussed in class on September 1.
• August 28: I won't be in class, but you are supposed to do Lab 4 today.
• Midterm exam on August 22, 6-8pm. Venue will be F223 for my 12:30 section and F228 for my 1:30 section; keep posted in case there are any changes.
• Defense for project 1 will be from Wednesday to Friday (Aug 16-18). Sign up sheets are available at the department (F209). No classes on Wednesday (Aug 16). Review classes on Friday (Aug 18, 12:30-1:30 class and 1:30-2:30 class-no lab).
• Some useful scripts (just click on the link and execute in your home machines)
• Notes/files for first week of classes:

### Labs

• Lab 1: print demo
• Lab 2
11:30 section- the Car class , REVISED LAB
1:30 section- the MobilePhone class , REVISED LAB
• Handson exams given: Sample handson (TollLanes) , Elevators , Soldiers .
• Lab 3: Grocery , Solution
• Lab exercises with loops
• Lab 4: Arrays
• This program demonstrates reversing N numbers from input.
• Write a program (called Stats.java) that takes in an integer N, then takes in N doubles, then outputs the sum, mean (or average), and standard deviation of those N doubles. Standard deviation is defined as the square root of the average of the squares of the elements' differences from the mean.
• Verify your program by typing in 3, and then these three numbers: 10.5, 3, 5.25. The sum should be 18.75, mean is 6.25, and standard deviation is 3.14245 = the squareroot of (4.25*4.25 + 3.25*3.25 + 1.00*1.00)/3)
• Submit the file Stats.java through moodle. Make sure you place your name in that program.
• Lab 5: Inheritance (submit a zip file of all java sources through moodle)
• Lab 6: Revise the following Java programs so that
1. There are two faces drawn on the canvas and both faces respond to the button actions. Arrange it so that the two faces have different sizes (Update the Face constructor to include size).
2. There is a button that causes the size of the faces drawn to grow.
3. Facial features (e.g., eyes and ears) are added to a face.
4. There is an add button that adds a new face to the canvas (use two text fields to indicate x and y coordinates). You will need to use arrays (an array of Faces in the FaceCanvas class).