0% found this document useful (0 votes)
10 views2 pages

Col Sum

The document outlines the design of a class named Colsum that checks if the sum of elements in corresponding columns of two matrices is equal. It includes details about data members, a parameterized constructor, methods for reading array elements, checking column sums, and printing the matrix. A main function is also specified to create objects and invoke these methods to perform the task.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Col Sum

The document outlines the design of a class named Colsum that checks if the sum of elements in corresponding columns of two matrices is equal. It includes details about data members, a parameterized constructor, methods for reading array elements, checking column sums, and printing the matrix. A main function is also specified to create objects and invoke these methods to perform the task.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Design a class Colsum to check if the sum of elements in each corresponding

column of two matrices is equal or not. Assume that the two matrices have the
same dimensions.
Example:
INPUT:
Example:
INPUT:
2 3 1

7 5 6

1 4 2
MATRIX A
7 4 2

1 3 1

2 5 6
MATRIX B

OUTPUT: Sum of corresponding columns is equal.


The details of the members of the class are given below:

Class name: Colsum


Data members/instance variables:
mat[][]: to store the integer array elements
m: to store the number of rows
n: to store the number of columns
Member functions/methods:
Colsum(int mm, int nn): parameterized constructor to initialize the data members
m = mm and n = nn
void readArray(): to accept the elements into the array
boolean check(Colsum A, Colsum B): to check if the sum of elements in each
column of the objects A and B is equal and return true, otherwise return false
void print(): to display the array elements

Specify the class Colsum giving details of the constructor, void readArray(),
boolean check(Colsum, Colsum), and void print(). Define the main() function to
create objects and call the functions accordingly to enable the task.

You might also like