asg5 - COP 3530 Assignment 5 Due: 30th Sep 2009 1. Write a...

This preview shows pages 1–2. Sign up to view the full content.

COP 3530 Assignment 5 Due: 30 th Sep 2009 1. Write a Java program that (a) Defines two N by N matrices, A and B, and represents them using row lists and column lists respectively. (Lecture 11). (b) Adds the two matrices, producing a new N by N matrix C (represented using row lists), where C(i,j) = A(i,j) + B(i,j). (c) Prints the three matrices A, B and C. Notes: 1. Use the code template provided below. 2. Matrices A and B can be hard-coded in your program. 3. Your program must work for any N by N matrices A and B. 4. In the following code, you have to define the function addMatrices. Test your code for various values of N. 5. In the following code, each chain node, nodeElement contains two data elements, a – the index of row or column and b – the actual value at that location. package dataStructures; import java.util.*; public class matrixAdd extends Chain{ public static class nodeElement{ int a; int b; } public static void displayMatrix(Chain[] c, int N) { for(int i=1;i<=N;i++) { Iterator y = c[i].iterator();

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course COP 3530 taught by Professor Davis during the Fall '08 term at University of Florida.

Page1 / 3

asg5 - COP 3530 Assignment 5 Due: 30th Sep 2009 1. Write a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online