Computer Project
Computer Project
Scanner;
class DIasum {
int a[][], r, c;
DIasum(int r, int c) {
r = r;
c = c;
a = new int[r][c];
}
void read() {
a[i][j] = scanner.nextInt();
}
}
}
int sum() {
int sum = 0;
sum += a[i][j];
}
}
}
return sum;
}
void display() {
}
obj.read();
obj.display();
}
rows int main(), main() User input for the number of rows
cols int main(), main() User input for the number of columns
class BoundarySum {
int a[][], r, c;
BoundarySum(int r, int c) {
this.r = r;
this.c = c;
a = new int[r][c];
}
void read() {
a[i][j] = scanner.nextInt();
}
}
}
int sum() {
int sum = 0;
if (i == 0 || i == r - 1 || j == 0 || j == c - 1) {
sum += a[i][j];
}
}
}
return sum;
}
void display() {
}
obj.display();
}
Certainly! Here's the variable listing table for the modified code:
rows int main(), main() User input for the number of rows
cols int main(), main() User input for the number of columns
obj BoundarySum main() Object of the BoundarySum class