CS1101: Programming Methodology Aaron Tan

advertisement
CS1101: Programming Methodology
http://www.comp.nus.edu.sg/~cs1101x/
Aaron Tan
This is Week 10
 Week 9:
 Chapter 10: Arrays and ArrayLists
 This week:
 We will complete ArrayLists
 Exercise: Matrix multiplication
(Matrices.java)
 Chapter 11: Type Details and Alternate
Coding Mechanisms
 Mini-programming test
2
Exercise: Matrix Multiplication

To compute C = A  B, where A, B, C are matrices
 ci,j = (ai,1  b1,j ) + (ai,2  b2,j ) + . . . + (ai,n  bn,j )
 ci,j
is sum of terms produced by multiplying the
elements of A’s row i with B’s column j.

Example on 33 matrices:
1 2 0
 1 0 0 




0 1 1   2 1 0 
1 0 1
 0 2  1




3 2 0


  2 3  1
  1 2  1


 Please refer to MatricesSolution.java
3
Chapter 11

Let’s go to Chapter 11.
4
Mini Programming Test

Refer to hand-out.
5
Exercises
 Try last year’s lab #7 exercises:
 Sudoku
 Rabbit Jumps
 Polygon
 Go to course website, “Labs” page to
retrieve last year’s lab write-ups:
 http://www.comp.nus.edu.sg/~cs1101x/3_ca/labs.html
6
Announcement/Reminder
 Lab #4
 Deadline: 22 October (Wednesday), 2359 hr.
 Identical codes
 Please do not share codes for your lab
assignments!
7
This is Week 10
 Next week?
 No lecture!
 No discussion session!
 Week 12
 Chapter 14 Exception Handling
 Chapter 15 Files
8
End of file
9
Download