added old projects

This commit is contained in:
Austin Bennett
2026-02-03 08:18:39 -06:00
parent 43acf989bf
commit 2451448b8a
623 changed files with 28117 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin"
}
+18
View File
@@ -0,0 +1,18 @@
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
Binary file not shown.
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
public class App {
public static void main(String[] args) throws Exception {
int arr[][] = {{1, 5, 9,},
{8, 3, 4 },
{6, 7, 2 }};
Magic matrix = new Magic(arr);
System.out.println(matrix.magic());
}
}
+61
View File
@@ -0,0 +1,61 @@
public class Magic {
int _matrix[][] = { {1, 5, 9 },
{8, 3, 4 },
{6, 7, 2 }};;
public Magic(int matrix[][]) {
if(matrix.length != matrix[0].length) {
throw new IllegalArgumentException("Not Square");
} else {
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[0].length; j++) {
_matrix[i][j] = matrix[i][j];
}
}
}
}
public boolean rowSemiMagic() {
int rowSums[] = new int[_matrix.length];
int sumRow;
for (int i = 0; i < _matrix.length; i++) {
sumRow = 0;
for (int j = 0; j <_matrix[0].length; j++) {
sumRow += _matrix[i][j];
rowSums[i] = sumRow;
}
}
for (int i = 0; i < rowSums.length; i++) {
if (rowSums[0] != rowSums[i]) {
return false;
}
}
return true;
}
public boolean columnSemiMagic() {
int columnSums[] = new int[_matrix[0].length];
int sumColumn;
for (int i = 0; i < _matrix.length; i++) {
sumColumn = 0;
for (int j = 0; j <_matrix[0].length; j++) {
sumColumn += _matrix[i][j];
columnSums[i] = sumColumn;
}
}
for (int i = 0; i < columnSums.length; i++) {
if (columnSums[0] != columnSums[i]) {
return false;
}
}
return true;
}
public boolean magic() {
if (rowSemiMagic() && columnSemiMagic()) {
return true;
} else {
return false;
}
}
}