├── Unit1
├── code
│ ├── Assignment6
│ │ ├── app
│ │ │ ├── .settings
│ │ │ │ └── org.eclipse.buildship.core.prefs
│ │ │ ├── bin
│ │ │ │ ├── main
│ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── App.class
│ │ │ │ └── test
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── AppTest.class
│ │ │ ├── .project
│ │ │ ├── build.gradle.kts
│ │ │ ├── .classpath
│ │ │ └── src
│ │ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── App.java
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── settings.gradle.kts
│ │ ├── .project
│ │ └── gradlew.bat
│ ├── Assignment2
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── settings.gradle.kts
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── test
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── App.java
│ │ │ └── build.gradle.kts
│ │ ├── gradlew.bat
│ │ └── gradlew
│ ├── Assignment3
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── settings.gradle.kts
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── App.java
│ │ │ │ └── test
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── AppTest.java
│ │ │ └── build.gradle.kts
│ │ ├── gradlew.bat
│ │ └── gradlew
│ ├── Assignment4
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── test
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── App.java
│ │ │ └── build.gradle.kts
│ │ ├── settings.gradle.kts
│ │ └── gradlew.bat
│ ├── Assignment5
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── settings.gradle.kts
│ │ ├── app
│ │ │ ├── build.gradle.kts
│ │ │ └── src
│ │ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── App.java
│ │ └── gradlew.bat
│ ├── Assignment7
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── settings.gradle.kts
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── test
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── App.java
│ │ │ └── build.gradle.kts
│ │ └── gradlew.bat
│ ├── Assignment8
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── gradle.properties
│ │ ├── .gitattributes
│ │ ├── settings.gradle.kts
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── test
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── App.java
│ │ │ └── build.gradle.kts
│ │ └── gradlew.bat
│ ├── Assignment1
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ ├── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ │ └── libs.versions.toml
│ │ ├── .gitattributes
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── test
│ │ │ │ │ └── java
│ │ │ │ │ │ └── org
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── AppTest.java
│ │ │ │ └── main
│ │ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── App.java
│ │ │ └── build.gradle.kts
│ │ ├── .gitignore
│ │ ├── settings.gradle.kts
│ │ ├── gradlew.bat
│ │ └── gradlew
│ └── Assignment9
│ │ └── README.md
└── .vscode
│ └── settings.json
├── Unit2
└── code
│ ├── Assignment1
│ ├── app
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── bin
│ │ │ ├── main
│ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── BankAccount.class
│ │ │ └── test
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── BankAccountTest.class
│ │ ├── src
│ │ │ ├── main
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── BankAccount.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── BankAccountTest.java
│ │ ├── .project
│ │ ├── build.gradle.kts
│ │ └── .classpath
│ ├── .gitignore
│ ├── kls_database.db
│ ├── gradle
│ │ ├── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ └── libs.versions.toml
│ ├── gradle.properties
│ ├── .gitattributes
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── settings.gradle.kts
│ ├── .project
│ └── gradlew.bat
│ ├── Assignment2
│ ├── app
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── bin
│ │ │ ├── main
│ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── Rectangle.class
│ │ │ └── test
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── RectangleTest.class
│ │ ├── src
│ │ │ ├── main
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── Rectangle.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── RectangleTest.java
│ │ ├── .project
│ │ ├── build.gradle.kts
│ │ └── .classpath
│ ├── .gitignore
│ ├── kls_database.db
│ ├── gradle
│ │ ├── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ └── libs.versions.toml
│ ├── gradle.properties
│ ├── .gitattributes
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── settings.gradle.kts
│ ├── .project
│ └── gradlew.bat
│ ├── Assignment3
│ ├── app
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── bin
│ │ │ ├── main
│ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ ├── Car.class
│ │ │ │ │ └── Vehicle.class
│ │ │ └── test
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── VehicleTest.class
│ │ ├── src
│ │ │ ├── main
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── Vehicle.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── VehicleTest.java
│ │ ├── .project
│ │ ├── build.gradle.kts
│ │ └── .classpath
│ ├── .gitignore
│ ├── kls_database.db
│ ├── gradle
│ │ ├── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ └── libs.versions.toml
│ ├── gradle.properties
│ ├── .gitattributes
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── settings.gradle.kts
│ ├── .project
│ └── gradlew.bat
│ ├── Assignment4
│ ├── app
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── bin
│ │ │ ├── main
│ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ ├── Circle.class
│ │ │ │ │ └── Drawable.class
│ │ │ └── test
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── DrawableTest.class
│ │ ├── src
│ │ │ ├── main
│ │ │ │ └── java
│ │ │ │ │ └── org
│ │ │ │ │ └── example
│ │ │ │ │ └── Circle.java
│ │ │ └── test
│ │ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── DrawableTest.java
│ │ ├── .project
│ │ ├── build.gradle.kts
│ │ └── .classpath
│ ├── .gitignore
│ ├── gradle
│ │ ├── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ └── libs.versions.toml
│ ├── gradle.properties
│ ├── .gitattributes
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── settings.gradle.kts
│ ├── .project
│ └── gradlew.bat
│ └── Assignment5
│ ├── app
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── bin
│ │ ├── main
│ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── MathUtility.class
│ │ └── test
│ │ │ └── org
│ │ │ └── example
│ │ │ └── MathUtilityTest.class
│ ├── src
│ │ ├── main
│ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── example
│ │ │ │ └── MathUtility.java
│ │ └── test
│ │ │ └── java
│ │ │ └── org
│ │ │ └── example
│ │ │ └── MathUtilityTest.java
│ ├── .project
│ ├── build.gradle.kts
│ └── .classpath
│ ├── .gitignore
│ ├── kls_database.db
│ ├── gradle
│ ├── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ └── libs.versions.toml
│ ├── gradle.properties
│ ├── .gitattributes
│ ├── .settings
│ └── org.eclipse.buildship.core.prefs
│ ├── settings.gradle.kts
│ ├── .project
│ └── gradlew.bat
├── README.md
└── Unit3
└── NOTES.md
/Unit1/code/Assignment6/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/kls_database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment1/kls_database.db
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/kls_database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment2/kls_database.db
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/kls_database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment3/kls_database.db
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/kls_database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment5/kls_database.db
--------------------------------------------------------------------------------
/Unit1/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.compile.nullAnalysis.mode": "automatic",
3 | "java.format.settings.url": ".vscode/java-formatter.xml",
4 | "[java]": {
5 | "editor.insertSpaces": false
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment5/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/bin/main/org/example/App.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment6/app/bin/main/org/example/App.class
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment7/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/bin/main/org/example/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment3/app/bin/main/org/example/Car.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment5/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/bin/main/org/example/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment4/app/bin/main/org/example/Circle.class
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/bin/test/org/example/AppTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit1/code/Assignment6/app/bin/test/org/example/AppTest.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/bin/main/org/example/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment3/app/bin/main/org/example/Vehicle.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/bin/main/org/example/Drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment4/app/bin/main/org/example/Drawable.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/bin/main/org/example/BankAccount.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment1/app/bin/main/org/example/BankAccount.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/bin/main/org/example/Rectangle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment2/app/bin/main/org/example/Rectangle.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/bin/test/org/example/VehicleTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment3/app/bin/test/org/example/VehicleTest.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/bin/main/org/example/MathUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment5/app/bin/main/org/example/MathUtility.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/bin/test/org/example/RectangleTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment2/app/bin/test/org/example/RectangleTest.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/bin/test/org/example/DrawableTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment4/app/bin/test/org/example/DrawableTest.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/bin/test/org/example/BankAccountTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment1/app/bin/test/org/example/BankAccountTest.class
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/bin/test/org/example/MathUtilityTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Amrita-School-of-AI/22AIE111-Object-Oriented-Programming-in-Java-S2-2025/HEAD/Unit2/code/Assignment5/app/bin/test/org/example/MathUtilityTest.class
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/gradle.properties:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3 |
4 | org.gradle.configuration-cache=true
5 |
6 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 | # Binary files should be left untouched
11 | *.jar binary
12 |
13 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | # This file was generated by the Gradle 'init' task.
2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3 |
4 | [versions]
5 | guava = "33.3.1-jre"
6 | junit-jupiter = "5.11.1"
7 |
8 | [libraries]
9 | guava = { module = "com.google.guava:guava", version.ref = "guava" }
10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
11 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import org.junit.jupiter.api.Test;
5 |
6 | class AppTest {
7 | @Test
8 | public void testSayHello() {
9 | App app = new App();
10 | String expected = "Hello World!";
11 | String actual = app.sayHello();
12 | assertEquals(expected, actual, "The sayHello method should return 'Hello World!'");
13 | }}
14 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
7 | # Gradle Wrapper files
8 | /.gradle/
9 | /gradle/wrapper/gradle-wrapper.jar
10 |
11 | # IntelliJ IDEA files
12 | /.idea/
13 | /*.iml
14 |
15 | # Eclipse files
16 | .classpath
17 | .project
18 | .settings/
19 |
20 | # VS Code files
21 | /.vscode/
22 |
23 | # OS-specific files
24 | .DS_Store
25 | Thumbs.db
26 |
27 | # Logs
28 | *.log
29 |
30 | # Temporary files
31 | *.tmp
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | public class App {
4 |
5 | /**
6 | * Returns the string "Hello World!".
7 | *
8 | * @return A greeting message.
9 | */
10 | public String sayHello() {
11 | // TODO: Implement this method to return "Hello World!"
12 | return "";
13 | }
14 |
15 | public static void main(String[] args) {
16 | App app = new App();
17 | System.out.println(app.sayHello());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/src/main/java/org/example/Vehicle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Assignment: Implement a vehicle inheritance structure with method overriding.
3 | */
4 | package org.example;
5 |
6 | // Vehicle.java
7 | public class Vehicle {
8 | public String startEngine() {
9 | return "Engine started";
10 | }
11 | }
12 |
13 | // Car.java
14 | public class Car extends Vehicle {
15 | @Override
16 | public String startEngine() {
17 | // TODO: Add "Car" prefix to parent's message
18 | return "";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=--init-script /home/abhijith/.cache/jdtls/config/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/usr/lib/jvm/java-21-openjdk-amd64
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testAreaAndPerimeter() {
10 | // Sample test using length=5, width=3
11 | App rectangle = new App(5, 3);
12 |
13 | assertEquals(15, rectangle.getArea(), "Area should be 15 for length=5, width=3");
14 | assertEquals(16, rectangle.getPerimeter(), "Perimeter should be 16 for length=5, width=3");
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/src/main/java/org/example/Circle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Assignment: Implement a Drawable interface with Circle class.
3 | */
4 | package org.example;
5 |
6 | // Drawable.java
7 | public interface Drawable {
8 | String draw();
9 | }
10 |
11 | // Circle.java
12 | public class Circle implements Drawable {
13 | private double radius;
14 |
15 | public Circle(double radius) {
16 | // TODO: Initialize
17 | }
18 |
19 | @Override
20 | public String draw() {
21 | // TODO: Return "Drawing circle with radius X"
22 | return "";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "HelloWorld"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Data Types"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Variables"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Operators"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Assignment1"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Assignment1"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Assignment1"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Assignment1"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Assignment1"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Control Statements"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Basic Program Syntax"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "The Concept of References"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.12.1/userguide/multi_project_builds.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs
10 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
11 | }
12 |
13 | rootProject.name = "Value Types and Reference Types"
14 | include("app")
15 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/src/main/java/org/example/MathUtility.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Assignment: Create a MathUtility class with overloaded add methods.
3 | */
4 | package org.example;
5 |
6 | // MathUtility.java
7 | public class MathUtility {
8 | // Add two integers
9 | public static int add(int a, int b) {
10 | return 0; // TODO: Implement
11 | }
12 |
13 | // Add three integers
14 | public static int add(int a, int b, int c) {
15 | return 0; // TODO: Implement
16 | }
17 |
18 | // Add two doubles
19 | public static double add(double a, double b) {
20 | return 0; // TODO: Implement
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/src/test/java/org/example/MathUtilityTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file was generated by the Gradle 'init' task
3 | */
4 | package org.example;
5 |
6 | import org.junit.jupiter.api.Test;
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | public class MathUtilityTest {
10 | @Test
11 | public void testAddTwoInts() {
12 | assertEquals(15, MathUtility.add(10, 5));
13 | }
14 |
15 | @Test
16 | public void testAddThreeInts() {
17 | assertEquals(20, MathUtility.add(5, 10, 5));
18 | }
19 |
20 | @Test
21 | public void testAddDoubles() {
22 | assertEquals(7.5, MathUtility.add(3.2, 4.3), 0.001);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/src/test/java/org/example/DrawableTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file was generated by the Gradle 'init' task
3 | */
4 | package org.example;
5 |
6 | import org.junit.jupiter.api.Test;
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | // DrawableTest.java
10 | public class DrawableTest {
11 | @Test
12 | public void testCircleDrawing() {
13 | Drawable circle = new Circle(3.5);
14 | assertEquals("Drawing circle with radius 3.5", circle.draw());
15 | }
16 |
17 | @Test
18 | public void testZeroRadius() {
19 | Drawable circle = new Circle(0);
20 | assertEquals("Drawing circle with radius 0.0", circle.draw());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/src/main/java/org/example/BankAccount.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Assignment: Implement a BankAccount class with deposit/withdraw functionality and overdraft protection.
3 | * */
4 | package org.example;
5 |
6 | // BankAccount.java
7 | public class BankAccount {
8 | private double balance;
9 |
10 | public BankAccount(double initialBalance) {
11 | // TODO: Initialize balance
12 | }
13 |
14 | public void deposit(double amount) {
15 | // TODO: Add validation
16 | }
17 |
18 | public void withdraw(double amount) {
19 | // TODO: Add overdraft protection
20 | }
21 |
22 | public double getBalance() {
23 | return balance;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testSayWelcome() {
10 | App app = new App();
11 | String expected = "Welcome to Java Programming";
12 | String actual = app.sayWelcome();
13 | assertEquals(expected, actual, "sayWelcome() should return the correct welcome message.");
14 | }
15 |
16 | @Test
17 | void testSum() {
18 | App app = new App();
19 | int expected = 30;
20 | int actual = app.sum(10, 20);
21 | assertEquals(expected, actual, "sum(10, 20) should return 30.");
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/src/test/java/org/example/VehicleTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file was generated by the Gradle 'init' task
3 | */
4 | package org.example;
5 |
6 | import org.junit.jupiter.api.Test;
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | // VehicleTest.java
10 | import static org.junit.Assert.*;
11 | import org.junit.Test;
12 |
13 | public class VehicleTest {
14 | @Test
15 | public void testCarEngineStart() {
16 | Car car = new Car();
17 | String result = car.startEngine();
18 | assertEquals("Car: Engine started", result);
19 | }
20 |
21 | @Test
22 | public void testBaseVehicle() {
23 | Vehicle vehicle = new Vehicle();
24 | assertEquals("Engine started", vehicle.startEngine());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | public class App {
4 |
5 | /**
6 | * TODO: Return a multi-line string that lists each primitive data type,
7 | * its size in bits, and a note about its default value.
8 | *
9 | * Example output (one possible approach):
10 | * "byte: 8 bits, default = 0\nshort: 16 bits, default = 0\n..."
11 | *
12 | * @return A descriptive string for all primitive data types.
13 | */
14 | public String getDataTypesInfo() {
15 | // TODO
16 | return "";
17 | }
18 |
19 | public static void main(String[] args) {
20 | App app = new App();
21 | // Print the data types info
22 | System.out.println(app.getDataTypesInfo());
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/src/main/java/org/example/Rectangle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Assignment: Implement a Rectangle class with multiple constructors and area calculation.
3 | */
4 | package org.example;
5 |
6 | // Rectangle.java
7 | public class Rectangle {
8 | private int width;
9 | private int height;
10 |
11 | // Default constructor (1x1 rectangle)
12 | public Rectangle() {
13 | // TODO: Implement
14 | }
15 |
16 | // Square constructor
17 | public Rectangle(int size) {
18 | // TODO: Implement
19 | }
20 |
21 | // General rectangle
22 | public Rectangle(int width, int height) {
23 | // TODO: Implement
24 | }
25 |
26 | public int calculateArea() {
27 | // TODO: Implement
28 | return 0;
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/src/test/java/org/example/RectangleTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file was generated by the Gradle 'init' task
3 | */
4 | package org.example;
5 |
6 | // RectangleTest.java
7 | import org.junit.jupiter.api.Test;
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | public class RectangleTest {
11 | @Test
12 | public void testDefaultConstructor() {
13 | Rectangle rect = new Rectangle();
14 | assertEquals(1, rect.calculateArea());
15 | }
16 |
17 | @Test
18 | public void testSquareConstructor() {
19 | Rectangle square = new Rectangle(5);
20 | assertEquals(25, square.calculateArea());
21 | }
22 |
23 | @Test
24 | public void testGeneralConstructor() {
25 | Rectangle rect = new Rectangle(4, 6);
26 | assertEquals(24, rect.calculateArea());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Assignment1
4 | Project Assignment1 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1743261360102
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Assignment1-Assignment2
4 | Project Assignment2 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1743261833453
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Assignment1-Assignment3
4 | Project Assignment3 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1743261984427
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Assignment1-Assignment4
4 | Project Assignment4 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1743262135812
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Assignment1-Assignment5
4 | Project Assignment5 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1743262352219
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Control Statements-Assignment6
4 | Project Assignment6 created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1738030335093
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testSwapByValue() {
10 | App app = new App();
11 | int[] swapped = app.swapByValue(5, 10);
12 | // swapped[0] should be 10, swapped[1] should be 5
13 | assertEquals(10, swapped[0], "First element should now be 10");
14 | assertEquals(5, swapped[1], "Second element should now be 5");
15 | }
16 |
17 | @Test
18 | void testSwapByReference() {
19 | App app = new App();
20 | int[] pair = {5, 10};
21 | app.swapByReference(pair);
22 | // pair[0] should be 10, pair[1] should be 5
23 | assertEquals(10, pair[0], "First element should now be 10");
24 | assertEquals(5, pair[1], "Second element should now be 5");
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.example.references.App.Person;
5 | import static org.junit.jupiter.api.Assertions.*;
6 |
7 | class AppTest {
8 |
9 | @Test
10 | void testPrimitiveChange() {
11 | App app = new App();
12 | int original = 10;
13 | app.changePrimitive(original);
14 | // The original should remain the same
15 | assertEquals(10, original, "Primitive value should not change after the method call.");
16 | }
17 |
18 | @Test
19 | void testReferenceChange() {
20 | App app = new App();
21 | Person person = new Person("Alice");
22 | app.changeReference(person);
23 | // We expect the person's name to be changed inside the method
24 | assertEquals("Changed Name", person.name, "Person's name should be changed inside the method.");
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/src/test/java/org/example/BankAccountTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file was generated by the Gradle 'init' task
3 | */
4 | package org.example;
5 |
6 | // BankAccountTest.java
7 | import org.junit.jupiter.api.Test;
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 |
11 | public class BankAccountTest {
12 | @Test
13 | public void testInitialBalance() {
14 | BankAccount acc = new BankAccount(100.0);
15 | assertEquals(100.0, acc.getBalance(), 0.001);
16 | }
17 |
18 | @Test
19 | public void testValidWithdrawal() {
20 | BankAccount acc = new BankAccount(200.0);
21 | acc.withdraw(50.0);
22 | assertEquals(150.0, acc.getBalance(), 0.001);
23 | }
24 |
25 | @Test(expected = IllegalArgumentException.class)
26 | public void testOverdraftProtection() {
27 | BankAccount acc = new BankAccount(100.0);
28 | acc.withdraw(150.0);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testGetDataTypesInfo() {
10 | App app = new App();
11 | String info = app.getDataTypesInfo();
12 |
13 | // Basic checks to see if required data types are mentioned
14 | assertTrue(info.contains("byte"), "Should mention byte");
15 | assertTrue(info.contains("short"), "Should mention short");
16 | assertTrue(info.contains("int"), "Should mention int");
17 | assertTrue(info.contains("long"), "Should mention long");
18 | assertTrue(info.contains("float"), "Should mention float");
19 | assertTrue(info.contains("double"), "Should mention double");
20 | assertTrue(info.contains("char"), "Should mention char");
21 | assertTrue(info.contains("boolean"), "Should mention boolean");
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1738030335098
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1743261360115
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1743261833472
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1743261984445
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1743262135827
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1743262352236
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | public class App {
4 |
5 | // TODO: Declare instance variables for length and width
6 | // e.g. private int length;
7 | // private int width;
8 |
9 | /**
10 | * TODO: Create a constructor that accepts length and width and assigns
11 | * them to the instance variables.
12 | */
13 | // public App(int length, int width) {
14 | // // TODO
15 | // }
16 |
17 | /**
18 | * TODO: Return the area of the rectangle (length * width).
19 | *
20 | * @return area of the rectangle
21 | */
22 | public int getArea() {
23 | // TODO
24 | return 0;
25 | }
26 |
27 | /**
28 | * TODO: Return the perimeter of the rectangle (2*(length+width)).
29 | *
30 | * @return perimeter of the rectangle
31 | */
32 | public int getPerimeter() {
33 | // TODO
34 | return 0;
35 | }
36 |
37 | public static void main(String[] args) {
38 | // TODO: Create an instance of App (rectangle) with some length & width
39 | // Print the area and perimeter
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import java.util.Arrays;
4 |
5 | public class App {
6 |
7 | /**
8 | * TODO: Swap two integers via 'returning' them in a 2-element array.
9 | *
10 | * @param a first integer
11 | * @param b second integer
12 | * @return an array of two elements: [swappedA, swappedB]
13 | */
14 | public int[] swapByValue(int a, int b) {
15 | // TODO
16 | return new int[]{a, b};
17 | }
18 |
19 | /**
20 | * TODO: Swap two integers in-place by reference.
21 | * We'll assume the array has exactly 2 elements: arr[0], arr[1].
22 | *
23 | * @param arr array of two integers
24 | */
25 | public void swapByReference(int[] arr) {
26 | // TODO
27 | }
28 |
29 | public static void main(String[] args) {
30 | App app = new App();
31 |
32 | // Demonstrate swapByValue
33 | int a = 5, b = 10;
34 | int[] swapped = app.swapByValue(a, b);
35 | System.out.println("swapByValue results: " + Arrays.toString(swapped));
36 |
37 | // Demonstrate swapByReference
38 | int[] pair = {5, 10};
39 | app.swapByReference(pair);
40 | System.out.println("swapByReference results: " + Arrays.toString(pair));
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.BankAccount"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.Rectangle"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.Vehicle"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.MathUtility"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import java.util.Scanner;
4 |
5 | public class App {
6 |
7 | /**
8 | * TODO: Return the string "Welcome to Java Programming".
9 | *
10 | * @return The welcome message.
11 | */
12 | public String sayWelcome() {
13 | // TODO: Return "Welcome to Java Programming"
14 | return "";
15 | }
16 |
17 | /**
18 | * TODO: Return the sum of two integers.
19 | *
20 | * @param a first integer
21 | * @param b second integer
22 | * @return the sum of a and b
23 | */
24 | public int sum(int a, int b) {
25 | // TODO: implement the sum logic
26 | return 0;
27 | }
28 |
29 | public static void main(String[] args) {
30 | App app = new App();
31 |
32 | // Print the welcome message
33 | System.out.println(app.sayWelcome());
34 |
35 | // Prompt the user for two numbers
36 | Scanner scanner = new Scanner(System.in);
37 |
38 | System.out.print("Enter the first number: ");
39 | int num1 = scanner.nextInt();
40 |
41 | System.out.print("Enter the second number: ");
42 | int num2 = scanner.nextInt();
43 |
44 | // Print their sum
45 | System.out.println("The sum is: " + app.sum(num1, num2));
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | public class App {
4 |
5 | /**
6 | * Person class with a 'name' field.
7 | */
8 | public static class Person {
9 | public String name;
10 |
11 | public Person(String name) {
12 | this.name = name;
13 | }
14 | }
15 |
16 | /**
17 | * TODO: Attempt to change an integer parameter inside this method
18 | * and show that it does NOT change outside the method.
19 | */
20 | public void changePrimitive(int num) {
21 | // TODO
22 | }
23 |
24 | /**
25 | * TODO: Change the 'name' field of the 'person' object.
26 | */
27 | public void changeReference(Person person) {
28 | // TODO
29 | }
30 |
31 | public static void main(String[] args) {
32 | App app = new App();
33 |
34 | // Demonstrate with primitive
35 | int myNumber = 10;
36 | System.out.println("Before changePrimitive: " + myNumber);
37 | app.changePrimitive(myNumber);
38 | System.out.println("After changePrimitive: " + myNumber);
39 |
40 | // Demonstrate with reference
41 | Person bob = new Person("Bob");
42 | System.out.println("Before changeReference: " + bob.name);
43 | app.changeReference(bob);
44 | System.out.println("After changeReference: " + bob.name);
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
45 | tasks.named("run") {
46 | standardInput = System.`in`
47 | }
48 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 | }
44 |
45 | tasks.named("run") {
46 | standardInput = System.`in`
47 | }
48 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java application project to get you started.
5 | * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12.1/userguide/building_java_projects.html in the Gradle documentation.
6 | */
7 |
8 | plugins {
9 | // Apply the application plugin to add support for building a CLI application in Java.
10 | application
11 | }
12 |
13 | repositories {
14 | // Use Maven Central for resolving dependencies.
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | // Use JUnit Jupiter for testing.
20 | testImplementation(libs.junit.jupiter)
21 |
22 | testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23 |
24 | // This dependency is used by the application.
25 | implementation(libs.guava)
26 | }
27 |
28 | // Apply a specific Java toolchain to ease working on different environments.
29 | java {
30 | toolchain {
31 | languageVersion = JavaLanguageVersion.of(21)
32 | }
33 | }
34 |
35 | application {
36 | // Define the main class for the application.
37 | mainClass = "org.example.App"
38 | }
39 |
40 | tasks.named("test") {
41 | // Use JUnit Platform for unit tests.
42 | useJUnitPlatform()
43 |
44 | // Test logging
45 | testLogging {
46 | events("passed", "skipped", "failed")
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testCheckSign() {
10 | App app = new App();
11 | assertEquals("Positive", app.checkSign(10));
12 | assertEquals("Negative", app.checkSign(-1));
13 | assertEquals("Zero", app.checkSign(0));
14 | }
15 |
16 | @Test
17 | void testGetDayName() {
18 | App app = new App();
19 | assertEquals("Monday", app.getDayName(1));
20 | assertEquals("Sunday", app.getDayName(7));
21 | assertEquals("Invalid day", app.getDayName(9));
22 | }
23 |
24 | @Test
25 | void testCalculateFactorial() {
26 | App app = new App();
27 | assertEquals(120, app.calculateFactorial(5));
28 | assertEquals(1, app.calculateFactorial(0));
29 | assertEquals(720, app.calculateFactorial(6));
30 | }
31 |
32 | @Test
33 | void testIsPrime() {
34 | App app = new App();
35 | assertTrue(app.isPrime(7), "7 should be prime");
36 | assertFalse(app.isPrime(8), "8 should not be prime");
37 | assertFalse(app.isPrime(1), "1 is not prime by definition");
38 | assertFalse(app.isPrime(-5), "Negative numbers are not prime");
39 | }
40 |
41 | @Test
42 | void testSumUntil() {
43 | App app = new App();
44 | assertEquals(15, app.sumUntil(5), "1+2+3+4+5 = 15");
45 | assertEquals(1, app.sumUntil(1), "Limit=1 => 1");
46 | assertEquals(55, app.sumUntil(10), "1+2+...+10 = 55");
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/app/src/test/java/org/example/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.*;
5 |
6 | class AppTest {
7 |
8 | @Test
9 | void testArithmetic() {
10 | App app = new App();
11 | // Checking actual arithmetic results:
12 | assertEquals(13, app.add(10, 3), "10 + 3 should be 13");
13 | assertEquals(7, app.subtract(10, 3), "10 - 3 should be 7");
14 | assertEquals(30, app.multiply(10, 3), "10 * 3 should be 30");
15 | assertEquals(3, app.divide(10, 3), "10 / 3 (integer division) should be 3");
16 | assertEquals(1, app.modulus(10, 3), "10 % 3 should be 1");
17 | }
18 |
19 | @Test
20 | void testRelational() {
21 | App app = new App();
22 | // Checking relational results:
23 | assertTrue(app.greaterThan(10, 3), "10 > 3 should be true");
24 | assertTrue(app.equalTo(10, 10), "10 == 10 should be true");
25 | assertTrue(app.lessThanOrEqual(3, 3), "3 <= 3 should be true");
26 | assertFalse(app.greaterThan(3, 10), "3 > 10 should be false");
27 | }
28 |
29 | @Test
30 | void testLogical() {
31 | App app = new App();
32 | // Checking logical results:
33 | assertFalse(app.logicalAnd(true, false), "true && false should be false");
34 | assertTrue(app.logicalOr(true, false), "true || false should be true");
35 | assertFalse(app.logicalNot(true), "!true should be false");
36 | }
37 |
38 | @Test
39 | void testBitwise() {
40 | App app = new App();
41 | // Checking bitwise results:
42 | // 5 = 0101 (binary), 3 = 0011
43 | assertEquals(1, app.bitwiseAnd(5, 3), "0101 & 0011 = 0001 -> 1");
44 | assertEquals(7, app.bitwiseOr(5, 3), "0101 | 0011 = 0111 -> 7");
45 | assertEquals(6, app.bitwiseXor(5, 3), "0101 ^ 0011 = 0110 -> 6");
46 | // ~5 = ... depends on integer representation, but typically ~0101 -> ...11111010 in 32-bit
47 | // We can check specifically if it matches the two's complement result
48 | assertEquals(~5, app.bitwiseNot(5), "bitwise NOT of 5 should match ~5 in Java");
49 | assertEquals(10, app.leftShift(5, 1), "0101 << 1 = 1010 -> 10");
50 | assertEquals(2, app.rightShift(5, 1), "0101 >> 1 = 0010 -> 2");
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | import java.util.Scanner;
4 |
5 | public class App {
6 |
7 | /**
8 | * TODO: Uses if-else to check if 'number' is positive, negative, or zero.
9 | * Return:
10 | * - "Positive" if number > 0
11 | * - "Negative" if number < 0
12 | * - "Zero" if number == 0
13 | */
14 | public String checkSign(int number) {
15 | // TODO
16 | return "";
17 | }
18 |
19 | /**
20 | * TODO: Uses switch-case to return the day of the week:
21 | * 1 -> "Monday"
22 | * 2 -> "Tuesday"
23 | * 3 -> "Wednesday"
24 | * 4 -> "Thursday"
25 | * 5 -> "Friday"
26 | * 6 -> "Saturday"
27 | * 7 -> "Sunday"
28 | * Otherwise, return "Invalid day".
29 | */
30 | public String getDayName(int day) {
31 | // TODO
32 | return "";
33 | }
34 |
35 | /**
36 | * TODO: Uses a for loop to calculate factorial of n.
37 | * Factorial n! = 1 * 2 * 3 * ... * n
38 | * Assume n >= 0 (factorial(0) = 1)
39 | */
40 | public long calculateFactorial(int n) {
41 | // TODO
42 | return 0;
43 | }
44 |
45 | /**
46 | * TODO: Uses a while loop (or for loop) to check if 'number' is prime.
47 | * Return true if prime, false otherwise.
48 | * A prime number is a number > 1 that has no divisors other than 1 and itself.
49 | */
50 | public boolean isPrime(int number) {
51 | // TODO
52 | return false;
53 | }
54 |
55 | /**
56 | * TODO: Uses a do-while loop to sum integers from 1 up to 'limit'.
57 | * Example: sumUntil(5) => 1 + 2 + 3 + 4 + 5 = 15
58 | */
59 | public int sumUntil(int limit) {
60 | // TODO
61 | return 0;
62 | }
63 |
64 | public static void main(String[] args) {
65 | App app = new App();
66 |
67 | // if-else
68 | System.out.println("checkSign(-10) = " + app.checkSign(-10)); // "Negative", e.g.
69 | System.out.println("checkSign(0) = " + app.checkSign(0)); // "Zero"
70 | System.out.println("checkSign(5) = " + app.checkSign(5)); // "Positive"
71 |
72 | // switch-case
73 | System.out.println("\ngetDayName(1) = " + app.getDayName(1)); // "Monday"
74 | System.out.println("getDayName(7) = " + app.getDayName(7)); // "Sunday"
75 | System.out.println("getDayName(9) = " + app.getDayName(9)); // "Invalid day"
76 |
77 | // for loop
78 | System.out.println("\ncalculateFactorial(5) = " + app.calculateFactorial(5)); // 120
79 | System.out.println("calculateFactorial(0) = " + app.calculateFactorial(0)); // 1
80 |
81 | // while loop
82 | System.out.println("\nisPrime(7) = " + app.isPrime(7)); // true
83 | System.out.println("isPrime(8) = " + app.isPrime(8)); // false
84 | System.out.println("isPrime(1) = " + app.isPrime(1)); // false
85 |
86 | // do-while
87 | System.out.println("\nsumUntil(5) = " + app.sumUntil(5)); // 15
88 | }
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment4/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment6/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment7/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment8/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment1/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment2/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment3/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment4/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit2/code/Assignment5/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment5/app/src/main/java/org/example/App.java:
--------------------------------------------------------------------------------
1 | package org.example;
2 |
3 | public class App {
4 |
5 | /* ==============
6 | ARITHMETIC
7 | ============== */
8 | /**
9 | * TODO: Return the sum of two integers.
10 | */
11 | public int add(int a, int b) {
12 | // TODO
13 | return 0;
14 | }
15 |
16 | /**
17 | * TODO: Return the difference of two integers.
18 | */
19 | public int subtract(int a, int b) {
20 | // TODO
21 | return 0;
22 | }
23 |
24 | /**
25 | * TODO: Return the product of two integers.
26 | */
27 | public int multiply(int a, int b) {
28 | // TODO
29 | return 0;
30 | }
31 |
32 | /**
33 | * TODO: Return the integer division result (a / b).
34 | * Assume b != 0.
35 | */
36 | public int divide(int a, int b) {
37 | // TODO
38 | return 0;
39 | }
40 |
41 | /**
42 | * TODO: Return the remainder (modulus) when a is divided by b.
43 | * Assume b != 0.
44 | */
45 | public int modulus(int a, int b) {
46 | // TODO
47 | return 0;
48 | }
49 |
50 | /* ==============
51 | RELATIONAL
52 | ============== */
53 | /**
54 | * TODO: Return true if a > b.
55 | */
56 | public boolean greaterThan(int a, int b) {
57 | // TODO
58 | return false;
59 | }
60 |
61 | /**
62 | * TODO: Return true if a == b.
63 | */
64 | public boolean equalTo(int a, int b) {
65 | // TODO
66 | return false;
67 | }
68 |
69 | /**
70 | * TODO: Return true if a <= b.
71 | */
72 | public boolean lessThanOrEqual(int a, int b) {
73 | // TODO
74 | return false;
75 | }
76 |
77 | /* ==============
78 | LOGICAL
79 | ============== */
80 | /**
81 | * TODO: Return the result of logical AND on x and y.
82 | */
83 | public boolean logicalAnd(boolean x, boolean y) {
84 | // TODO
85 | return false;
86 | }
87 |
88 | /**
89 | * TODO: Return the result of logical OR on x and y.
90 | */
91 | public boolean logicalOr(boolean x, boolean y) {
92 | // TODO
93 | return false;
94 | }
95 |
96 | /**
97 | * TODO: Return the result of logical NOT on x.
98 | */
99 | public boolean logicalNot(boolean x) {
100 | // TODO
101 | return false;
102 | }
103 |
104 | /* ==============
105 | BITWISE
106 | ============== */
107 | /**
108 | * TODO: Return the result of bitwise AND on a and b.
109 | */
110 | public int bitwiseAnd(int a, int b) {
111 | // TODO
112 | return 0;
113 | }
114 |
115 | /**
116 | * TODO: Return the result of bitwise OR on a and b.
117 | */
118 | public int bitwiseOr(int a, int b) {
119 | // TODO
120 | return 0;
121 | }
122 |
123 | /**
124 | * TODO: Return the result of bitwise XOR on a and b.
125 | */
126 | public int bitwiseXor(int a, int b) {
127 | // TODO
128 | return 0;
129 | }
130 |
131 | /**
132 | * TODO: Return the bitwise complement of a.
133 | */
134 | public int bitwiseNot(int a) {
135 | // TODO
136 | return 0;
137 | }
138 |
139 | /**
140 | * TODO: Return the result of left-shifting a by shift bits.
141 | */
142 | public int leftShift(int a, int shift) {
143 | // TODO
144 | return 0;
145 | }
146 |
147 | /**
148 | * TODO: Return the result of right-shifting a by shift bits.
149 | */
150 | public int rightShift(int a, int shift) {
151 | // TODO
152 | return 0;
153 | }
154 |
155 | public static void main(String[] args) {
156 | App app = new App();
157 |
158 | // ARITHMETIC
159 | System.out.println("Arithmetic Examples:");
160 | System.out.println("add(10, 3) = " + app.add(10, 3));
161 | System.out.println("subtract(10, 3) = " + app.subtract(10, 3));
162 | System.out.println("multiply(10, 3) = " + app.multiply(10, 3));
163 | System.out.println("divide(10, 3) = " + app.divide(10, 3));
164 | System.out.println("modulus(10, 3) = " + app.modulus(10, 3));
165 |
166 | // RELATIONAL
167 | System.out.println("\nRelational Examples:");
168 | System.out.println("greaterThan(10, 3) = " + app.greaterThan(10, 3));
169 | System.out.println("equalTo(10, 10) = " + app.equalTo(10, 10));
170 | System.out.println("lessThanOrEqual(3, 3) = " + app.lessThanOrEqual(3, 3));
171 |
172 | // LOGICAL
173 | System.out.println("\nLogical Examples:");
174 | System.out.println("logicalAnd(true, false) = " + app.logicalAnd(true, false));
175 | System.out.println("logicalOr(true, false) = " + app.logicalOr(true, false));
176 | System.out.println("logicalNot(true) = " + app.logicalNot(true));
177 |
178 | // BITWISE
179 | System.out.println("\nBitwise Examples:");
180 | System.out.println("bitwiseAnd(5, 3) = " + app.bitwiseAnd(5, 3));
181 | System.out.println("bitwiseOr(5, 3) = " + app.bitwiseOr(5, 3));
182 | System.out.println("bitwiseXor(5, 3) = " + app.bitwiseXor(5, 3));
183 | System.out.println("bitwiseNot(5) = " + app.bitwiseNot(5));
184 | System.out.println("leftShift(5, 1) = " + app.leftShift(5, 1));
185 | System.out.println("rightShift(5, 1) = " + app.rightShift(5, 1));
186 | }
187 | }
188 |
189 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Object Oriented Programming in Java - General Instructions on how to use the repository
2 |
3 | Welcome to the **Object Oriented Programming in Java** repository! This repository contains notes and code examples organized into units, helping you understand and practice Java concepts step-by-step.
4 |
5 | ---
6 |
7 | ## Repository Structure
8 | The repository is organized into four main folders, each representing a unit of the course:
9 |
10 | - **Unit1/**
11 | - `NOTES.md` – Markdown notes covering fundamental OOP in Java concepts.
12 | - `code/` – Example Java programs (subfolders).
13 | - **Unit2/**
14 | - `NOTES.md`
15 | - `code/`
16 | - **Unit3/**
17 | - `NOTES.md`
18 | - `code/`
19 | - **Unit4/**
20 | - `NOTES.md`
21 | - `code/`
22 |
23 | Additionally, you will find:
24 | - **.vsode/**, **.idea/** – Contains setup files for Visual Studio Code (VS Code) and IntelliJ IDEA to help you load and run the Java projects in each of the subfolders.
25 |
26 | ---
27 |
28 | ## How to Use This Repository
29 |
30 | 1. **Browse the Notes**
31 | Within each unit folder, find the `NOTES.md` Markdown (`.md`) files. These notes will guide you through the theoretical concepts of each unit.
32 |
33 | 2. **Explore the Code Examples**
34 | In the `code` subfolder under each unit, you will find practical Java examples illustrating the concepts discussed in the notes. Each example might be in its own subfolder.
35 |
36 | 3. **Run and Experiment**
37 | Feel free to modify the example code or create your own Java files to practice. Instructions on setting up Java and running the code from the command line are provided below.
38 |
39 | 4. **Setup Files**
40 | - If you prefer using **VS Code**, refer to the files in the `setup/vscode` directory.
41 | - If you prefer using **IntelliJ IDEA**, refer to the files in the `setup/idea` directory.
42 |
43 | 5. **Prerequisites**
44 | Before you begin, ensure that the following tools are installed on your system:
45 | - Java Development Kit (JDK): Version 11 or higher.
46 | - Git: For version control.
47 | - Gradle: Although we'll use the Gradle Wrapper, having Gradle installed can be helpful.
48 | - Text Editor or IDE: Such as VS Code, IntelliJ IDEA, or Eclipse.
49 |
50 | ---
51 |
52 | ## Setting up Java on Linux (Ubuntu)
53 |
54 | You have two main options for installing the Java Development Kit (JDK): **Oracle JDK** or **OpenJDK**. Both will allow you to compile and run Java programs.
55 |
56 | ### 1. Installing OpenJDK (Recommended)
57 | OpenJDK is open-source and is typically the easiest to install on Ubuntu:
58 | ```bash
59 | sudo apt update
60 | sudo apt install openjdk-21-jdk
61 | ```
62 | *(You can replace `21` with the version you need, e.g., `openjdk-11-jdk`.)*
63 |
64 | ### 2. Installing Oracle JDK
65 | If you prefer Oracle’s official JDK:
66 | 1. Download the `.deb` package from the [Oracle Official Website](https://www.oracle.com/java/technologies/downloads/).
67 | 2. Navigate to the directory where the package is saved:
68 | ```bash
69 | cd /path/to/download
70 | ```
71 | 3. Install the package:
72 | ```bash
73 | sudo dpkg -i .deb
74 | ```
75 | 4. Verify installation:
76 | ```bash
77 | java -version
78 | ```
79 | You should see the Oracle JDK version displayed.
80 |
81 | ---
82 |
83 | ## Running Java Programs from the Command Line
84 |
85 | After installing Java (whether OpenJDK or Oracle JDK), you can compile and run the example code from the command line. Below is a general step-by-step guide:
86 |
87 | 1. **Open a Terminal**: Navigate (`cd`) to the directory containing the Java files you want to compile. For instance:
88 | ```bash
89 | cd /path/to/Unit1/code/Example1
90 | ```
91 |
92 | 2. **Compile the Java File(s)**:
93 | ```bash
94 | javac Main.java
95 | ```
96 | - `javac` is the Java compiler.
97 | - This will generate one or more `.class` files in the same directory.
98 |
99 | 3. **Run the Java Program**:
100 | ```bash
101 | java Main
102 | ```
103 | - Make sure **Main** is the class that contains the `public static void main(String[] args)` method.
104 |
105 | 4. **Passing Arguments (Optional)**:
106 | If your program requires command-line arguments, you can pass them like so:
107 | ```bash
108 | java Main arg1 arg2
109 | ```
110 |
111 | ---
112 |
113 | ## Loading the Projects in VS Code or IntelliJ IDEA
114 |
115 | ### Visual Studio Code
116 | 1. Install the **Java Extension Pack** from the VS Code Marketplace.
117 | 2. Copy or clone this repository to your local machine.
118 | 3. Open the root of this repository with VS Code.
119 | 4. The extension pack will detect the Java projects, and you can start editing, compiling, and debugging Java code directly within VS Code.
120 |
121 | ### IntelliJ IDEA
122 | 1. Install IntelliJ IDEA (Community Edition is sufficient).
123 | 2. Clone this repository to your local machine.
124 | 3. From the IntelliJ IDEA **Welcome** screen, select **Open** or **Import**.
125 | 4. Navigate to this repository’s root folder (or a specific unit’s `code` subfolder) and import it as a Maven/Gradle project if applicable, or simply as a Java project.
126 | 5. IntelliJ will automatically configure the project’s libraries and dependencies.
127 |
128 | ---
129 |
130 | ## Contributing
131 | If you find any issues or want to suggest improvements:
132 | - **Open an Issue**: Describe the problem or the idea you have.
133 | - **Submit a Pull Request**: Fork this repository, make changes, and submit a pull request for review.
134 |
135 | ---
136 |
137 | ## License
138 | This repository is intended for educational purposes. Feel free to fork and modify for your personal study or classroom use. If you plan to use it beyond that, please check the specific licensing details or contact the authors of the original work.
139 |
140 | ---
141 |
142 | **Happy Coding!**
143 | For any questions or clarifications regarding the course materials, feel free to reach out to me at `a_abhijith@cb.amrita.edu` or open an issue in this repository. Enjoy learning **Object Oriented Programming in Java**!
144 |
--------------------------------------------------------------------------------
/Unit3/NOTES.md:
--------------------------------------------------------------------------------
1 | # Exception Handling and Threading in Java
2 |
3 | ## Exception Handling
4 |
5 | ### 1. Introduction to Exception Handling
6 |
7 | - **Exception**: An event that disrupts normal program flow during execution
8 | - **Purpose**:
9 | - Prevent application crashes
10 | - Separate error-handling code from main logic
11 | - Provide meaningful error messages
12 | - **Key Concepts**:
13 | - Try: Block containing risky code
14 | - Catch: Handles specific exceptions
15 | - Finally: Cleanup code (always executes)
16 | - Throw: Explicitly generate exception
17 | - Throws: Declares possible exceptions
18 |
19 | ### 2. Exception Hierarchy
20 |
21 | ```java
22 | Throwable (root)
23 | ├── Error (unchecked - JVM serious failures)
24 | │ ├── OutOfMemoryError
25 | │ └── StackOverflowError
26 | │
27 | └── Exception (checked unless Runtime)
28 | ├── IOException
29 | ├── SQLException
30 | └── RuntimeException (unchecked)
31 | ├── NullPointerException
32 | └── ArrayIndexOutOfBoundsException
33 | ```
34 |
35 | ### 3. Exception Handling Constructs
36 |
37 | **Basic Try-Catch-Finally**:
38 |
39 | ```java
40 | try {
41 | FileReader file = new FileReader("test.txt");
42 | // Code that might throw IOException
43 | }
44 | catch (FileNotFoundException e) {
45 | System.err.println("File not found: " + e.getMessage());
46 | }
47 | catch (IOException e) {
48 | System.err.println("I/O Error: " + e.getMessage());
49 | }
50 | finally {
51 | // Close resources here
52 | if(file != null) file.close();
53 | }
54 | ```
55 |
56 | **Multiple Catch Blocks**:
57 |
58 | - Order matters: Specific → General
59 | - Java 7+ Multi-catch:
60 |
61 | ```java
62 | catch (IOException | SQLException e) {
63 | // Handle multiple exceptions
64 | }
65 | ```
66 |
67 | **Try-With-Resources (Java 7+)**:
68 |
69 | ```java
70 | try (BufferedReader br = new BufferedReader(new FileReader(path))) {
71 | return br.readLine();
72 | }
73 | // Auto-closes resources implementing AutoCloseable
74 | ```
75 |
76 | ### 4. Custom Exceptions
77 |
78 | ```java
79 | public class InsufficientFundsException extends Exception {
80 | private double deficit;
81 |
82 | public InsufficientFundsException(String message, double deficit) {
83 | super(message);
84 | this.deficit = deficit;
85 | }
86 |
87 | public double getDeficit() {
88 | return deficit;
89 | }
90 | }
91 |
92 | // Usage
93 | throw new InsufficientFundsException("Not enough balance", 500.0);
94 | ```
95 |
96 | ### 5. Best Practices
97 |
98 | - Use specific exception types
99 | - Document exceptions with Javadoc @throws
100 | - Clean up resources in finally blocks
101 | - Avoid empty catch blocks
102 | - Throw exceptions at appropriate abstraction levels
103 |
104 | ---
105 |
106 | ## Threading and Multithreading
107 |
108 | ### 1. Thread Fundamentals
109 |
110 | - **Thread**: Lightweight sub-process, basic unit of CPU utilization
111 | - **Key Benefits**:
112 | - Improved responsiveness
113 | - Better resource utilization
114 | - Simplified modeling of concurrent tasks
115 |
116 | ### 2. Thread Creation Methods
117 |
118 | **Method 1: Extend Thread Class**
119 |
120 | ```java
121 | class MyThread extends Thread {
122 | public void run() {
123 | System.out.println("Thread running: " + this.getName());
124 | }
125 | }
126 |
127 | // Usage
128 | MyThread t1 = new MyThread();
129 | t1.start();
130 | ```
131 |
132 | **Method 2: Implement Runnable Interface**
133 |
134 | ```java
135 | class MyRunnable implements Runnable {
136 | public void run() {
137 | System.out.println("Runnable thread running");
138 | }
139 | }
140 |
141 | // Usage
142 | Thread t2 = new Thread(new MyRunnable());
143 | t2.start();
144 | ```
145 |
146 | **Java 8+ Lambda Syntax**:
147 |
148 | ```java
149 | Thread t3 = new Thread(() -> {
150 | System.out.println("Lambda thread running");
151 | });
152 | t3.start();
153 | ```
154 |
155 | ### 3. Thread Lifecycle States
156 |
157 | 1. **New**: Created but not started
158 | 2. **Runnable**: Ready to run (in thread pool)
159 | 3. **Running**: Actively executing
160 | 4. **Blocked/Waiting**: Waiting for monitor lock
161 | 5. **Timed Waiting**: Sleeping or waiting with timeout
162 | 6. **Terminated**: Completed execution
163 |
164 | 
165 |
166 | ### 4. Thread Control Methods
167 |
168 | | Method | Description |
169 | | ------------------ | ------------------------------------- |
170 | | start() | Begins thread execution |
171 | | sleep(long millis) | Suspends execution for specified time |
172 | | join() | Waits for thread to die |
173 | | interrupt() | Interrupts waiting/sleeping thread |
174 | | setPriority(int) | Changes thread priority (1-10) |
175 |
176 | ### 5. Multithreading Concepts
177 |
178 | **Shared Resource Example**:
179 |
180 | ```java
181 | class Counter {
182 | private int count = 0;
183 |
184 | public synchronized void increment() { // Synchronized method
185 | count++;
186 | }
187 |
188 | public int getCount() {
189 | return count;
190 | }
191 | }
192 | ```
193 |
194 | **Common Issues**:
195 |
196 | - **Race Conditions**: Uncontrolled access to shared resources
197 | - **Deadlocks**: Circular waiting for resources
198 | - **Starvation**: Threads not getting CPU time
199 | - **Memory Consistency**: Visibility issues between threads
200 |
201 | **Synchronization Techniques**:
202 |
203 | 1. Synchronized methods/blocks
204 | 2. Volatile variables
205 | 3. Atomic classes (AtomicInteger, etc.)
206 | 4. Lock objects (ReentrantLock)
207 |
208 | ### 6. Executor Framework (Java 5+)
209 |
210 | ```java
211 | ExecutorService executor = Executors.newFixedThreadPool(5);
212 |
213 | executor.execute(() -> {
214 | // Task to execute
215 | });
216 |
217 | executor.shutdown(); // Important to prevent resource leaks
218 | ```
219 |
220 | ### 7. Best Practices
221 |
222 | - Prefer Runnable over Thread extension
223 | - Use thread pools instead of creating new threads
224 | - Avoid thread starvation with proper synchronization
225 | - Use higher-level concurrency utilities when possible
226 | - Always handle InterruptedException properly
227 |
228 | ---
229 |
230 | ## Common Exception Handling Patterns
231 |
232 | ### 1. Resource Management
233 |
234 | ```java
235 | try (Connection conn = DriverManager.getConnection(url);
236 | PreparedStatement stmt = conn.prepareStatement(sql)) {
237 |
238 | // Use resources
239 | }
240 | catch (SQLException e) {
241 | // Handle database errors
242 | }
243 | ```
244 |
245 | ### 2. Exception Translation
246 |
247 | ```java
248 | try {
249 | // Low-level code
250 | }
251 | catch (SpecificException e) {
252 | throw new HigherLevelException("Context message", e);
253 | }
254 | ```
255 |
256 | ### 3. Retry Logic
257 |
258 | ```java
259 | int retries = 3;
260 | while(retries > 0) {
261 | try {
262 | // Operation that might fail
263 | break;
264 | }
265 | catch (TemporaryException e) {
266 | if(--retries == 0) throw new PermanentFailure(e);
267 | Thread.sleep(1000);
268 | }
269 | }
270 | ```
271 |
272 | ---
273 |
274 | ## Thread Safety Levels
275 |
276 | | Safety Level | Description | Example |
277 | | -------------------- | ------------------------------------- | ----------------- |
278 | | Immutable | Object cannot change after creation | String, Integer |
279 | | Thread-confined | Only accessed by one thread | Local variables |
280 | | Synchronized | Access controlled via locking | Vector, Hashtable |
281 | | Concurrent | Lock-free thread-safe implementations | ConcurrentHashMap |
282 | | Unconditionally safe | Safe for all access patterns | Atomic classes |
283 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment9/README.md:
--------------------------------------------------------------------------------
1 | ```markdown
2 | # Assignment: Creating Java Projects in Different Ways
3 |
4 | ## Overview
5 |
6 | In this assignment, you'll learn how to create and run a **simple Java program** in several distinct ways. The program itself is straightforward: it prints `"Learning Java is fun!"` to the console. However, the **focus** is on becoming familiar with **multiple approaches** to setting up and running a Java project, from manual compilation on the command line to using modern build tools and IDEs.
7 |
8 | ---
9 |
10 | ## Task Description
11 |
12 | Create a Java program called `LearningJava.java` (or `App.java` if you prefer) with a `main` method that prints the message:
13 |
14 | ```plaintext
15 | Learning Java is fun!
16 | ```
17 |
18 | The **core** of the assignment is to **practice project creation** under different scenarios:
19 |
20 | 1. **Create the Java project from the command line** (no build tools, manual compile & run).
21 | 2. **Create the Java project using Gradle** (basic Gradle setup and build).
22 | 3. **Create the Java project in VSCode** (manually or via project templates).
23 | 4. **Create the Java project in VSCode using the Gradle plugin** (integrated build and run).
24 | 5. **Create the Java project using IntelliJ IDEA** (standard Java project).
25 | 6. **Create the Java project as a Gradle project in IntelliJ IDEA** (integrated Gradle support).
26 |
27 | Although the **source code** is the same in all scenarios, you’ll gain experience with different project structures, tools, and IDEs.
28 |
29 | ---
30 |
31 | ## Steps to Solve
32 |
33 | ### 1. Command Line (No Build Tool)
34 |
35 | 1. **Create a Folder**
36 | ```bash
37 | mkdir learning-java-cli
38 | cd learning-java-cli
39 | ```
40 | 2. **Write the Code**
41 | Create a file named `LearningJava.java`:
42 | ```java
43 | public class LearningJava {
44 | public static void main(String[] args) {
45 | System.out.println("Learning Java is fun!");
46 | }
47 | }
48 | ```
49 | 3. **Compile**
50 | ```bash
51 | javac LearningJava.java
52 | ```
53 | This generates `LearningJava.class`.
54 | 4. **Run**
55 | ```bash
56 | java LearningJava
57 | ```
58 | You should see:
59 | ```plaintext
60 | Learning Java is fun!
61 | ```
62 |
63 | ### 2. Gradle (Command Line)
64 |
65 | 1. **Initialize a Gradle Project**
66 | From a new directory, run:
67 | ```bash
68 | mkdir learning-java-gradle
69 | cd learning-java-gradle
70 | gradle init --type java-application
71 | ```
72 | select options:
73 |
74 | - target java version: 21
75 | - application structure: single application project
76 | - build scipt DSL: Kotlin
77 | - test framework: JUnit Jupiter
78 |
79 | or manually create the necessary `build.gradle`, `settings.gradle`, and `App.java`.
80 | 2. **Update the Main Class**
81 | By default, Gradle might generate a class `App.java` in `src/main/java`:
82 | ```java
83 | public class App {
84 | public static void main(String[] args) {
85 | System.out.println("Learning Java is fun!");
86 | }
87 | }
88 | ```
89 | 3. **Build and Run**
90 | - `gradle build`
91 | - `gradle run`
92 | If you used the Gradle init template, you can also see a generated test class, which you can modify or remove as needed.
93 |
94 | ### 3. VSCode (Manually)
95 |
96 | 1. **Install Extensions**
97 | - [Java Extension Pack](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack)
98 | 2. **Open the Assignment9 Folder**
99 | In VSCode, choose **File → Open Folder** and select `Assignment9/` folder.
100 |
101 | 3. **Create a project with Java Plugin**
102 | - Open commands prompt with `Ctrl+Shift+P`
103 | - Type: Java: Create Java Project... and press `Enter`
104 | - Select `No build tools` option
105 | - Select the present directory (`Assignment9`)
106 | - Give a name for the Java Project `learning-java-vscode`
107 | 4. **Edit the Java File (App.java) in src**
108 | ```java
109 | public class App {
110 | public static void main(String[] args) {
111 | System.out.println("Learning Java is fun!");
112 | }
113 | }
114 | ```
115 | 5. **Run**
116 | - Hover over the main method or the class, and click the **Run** or **Debug** link.
117 | - Alternatively, open the Command Palette (`Ctrl + Shift + P`), select **Java: Run**.
118 |
119 | ### 4. VSCode with Gradle Plugin
120 |
121 | 1. **Install Gradle for Java Extension**
122 | If you prefer a Gradle-based workflow within VSCode, install the [Gradle extension](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-gradle).
123 | 1. **Create a new directory within Assignment9**
124 | From `Assignment9` directory, run:
125 | ```bash
126 | mkdir learning-java-vscode-gradle
127 | ```
128 | 3. **Initialize a Gradle Project with Gradle Plugin**
129 | - Open commands prompt with `Ctrl+Shift+P`
130 | - Type: Gradle: Create a Gradle Java Project... and press `Enter`
131 | - Select the present directory (`learning-java-vscode-gradle`)
132 | - Select `Kotlin` for DSL
133 | - Give a name for the Java Project `LearningJava`
134 | 4.
135 | Create a file named `LearningJava.java`:
136 | By default, Gradle plugin will generate a class `App.java` in `app/src/main/java/learning/java/vscode/gradle`, you should remove this file.
137 | Also remove the `test/` folder
138 | Then add the file `LearningJava.java`
139 | ```java
140 | public class LearningJava {
141 | public static void main(String[] args) {
142 | System.out.println("Learning Java is fun!");
143 | }
144 | }
145 | ```
146 | 5. **Edit `build.gradle`**
147 | Ensure the `mainClassName` or `application` plugin points to your main class:
148 | ```kotlin
149 | application {
150 | // Define the main class for the application.
151 | mainClass = "learning.java.vscode.gradle.LearningJava"
152 | }
153 | ```
154 | 6. **Run**
155 | - Use `Ctrl+Shirt+P` to open command prompt and then type: `Gradle: Run a gradle build`
156 | - type the `run` command
157 | Use the **Gradle Tasks** panel in VSCode to run `build` or `run`.
158 |
159 | ### 5. IntelliJ IDEA (Standard Java Project)
160 |
161 | 1. **Create a New Project**
162 | - In IntelliJ, select **New Project** → **Java** → pick your desired JDK.
163 | - Select the path to folder `Assignment9`
164 | - Give the name of the porject as `learning-java-idea`
165 | - Pick IntelliJ as build tool
166 | 2. **Project Structure**
167 | IntelliJ will create a standard folder structure. By default:
168 | - `src/` → place your `LearningJava.java`.
169 | 3. **Write the Code**
170 | ```java
171 | public class LearningJava {
172 | public static void main(String[] args) {
173 | System.out.println("Learning Java is fun!");
174 | }
175 | }
176 | ```
177 | 4. **Run**
178 | - Right-click on the file → **Run 'LearningJava.main()'**.
179 | - IntelliJ compiles and executes the code, printing the message to the console.
180 |
181 | ### 6. IntelliJ IDEA (Gradle Project)
182 |
183 | 1. **New Project → Gradle**
184 | - In the **New Project** wizard, choose **Gradle** as the build system.
185 | - Select the path to folder `Assignment9`
186 | - Give the name of the porject as `learning-java-idea-gradle`
187 | - Select your JDK.
188 | 2. **Project Structure**
189 | - IntelliJ auto-generates `build.gradle`, `settings.gradle`, and the appropriate folders.
190 | 3. **Add the Main Class** in `src/main/java`:
191 | Rename the `Main.java` to `LearningJava.java` and update the content as below:
192 | ```java
193 | package org.example;
194 |
195 | public class LearningJava {
196 | public static void main(String[] args) {
197 | System.out.println("Learning Java is fun!");
198 | }
199 | }
200 | ```
201 | 4. **Sync & Run**
202 | - IntelliJ automatically syncs the Gradle project.
203 | - Use the **Gradle** tool window or the **Run** configuration to build and run.
204 |
205 | ---
206 |
207 | ## What You’ll Learn
208 |
209 | 1. **Command Line Compilation**
210 | You’ll understand the raw process (`javac`, `java`) without any automation.
211 |
212 | 2. **Gradle Builds**
213 | You’ll see how a build tool simplifies project organization and dependency management.
214 |
215 | 3. **VSCode Workflow**
216 | Learn about the Java Extension Pack, integrated debugging, and the Gradle plugin.
217 |
218 | 4. **IntelliJ IDEA Workflow**
219 | Gain familiarity with a popular Java IDE, including project wizards and Gradle integration.
220 |
221 | ---
222 |
223 | ## Submission Guidelines
224 |
225 | 1. **Pick at least two approaches** to demonstrate (though experimenting with all is encouraged).
226 | 2. **Push your code** to the repository or share screenshots showing each project structure and run output.
227 | 3. **Include a short note** on which approach you found easiest or most intuitive and why.
228 |
229 | ---
230 |
231 | ## Tips & Hints
232 |
233 | - **Check Java Version**
234 | Ensure that `java -version` displays the correct JDK version you intend to use.
235 | - **IDE vs. CLI**
236 | IDEs (like IntelliJ or VSCode) handle many steps automatically (compilation, packaging, etc.), but it’s valuable to understand how to do it manually.
237 | - **Gradle**
238 | Let the generated files scaffold your project structure. Spend time reading the `build.gradle` file to understand each line.
239 |
240 | ---
241 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment1/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | if ! command -v java >/dev/null 2>&1
137 | then
138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139 |
140 | Please set the JAVA_HOME variable in your environment to match the
141 | location of your Java installation."
142 | fi
143 | fi
144 |
145 | # Increase the maximum file descriptors if we can.
146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147 | case $MAX_FD in #(
148 | max*)
149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150 | # shellcheck disable=SC2039,SC3045
151 | MAX_FD=$( ulimit -H -n ) ||
152 | warn "Could not query maximum file descriptor limit"
153 | esac
154 | case $MAX_FD in #(
155 | '' | soft) :;; #(
156 | *)
157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158 | # shellcheck disable=SC2039,SC3045
159 | ulimit -n "$MAX_FD" ||
160 | warn "Could not set maximum file descriptor limit to $MAX_FD"
161 | esac
162 | fi
163 |
164 | # Collect all arguments for the java command, stacking in reverse order:
165 | # * args from the command line
166 | # * the main class name
167 | # * -classpath
168 | # * -D...appname settings
169 | # * --module-path (only if needed)
170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171 |
172 | # For Cygwin or MSYS, switch paths to Windows format before running java
173 | if "$cygwin" || "$msys" ; then
174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176 |
177 | JAVACMD=$( cygpath --unix "$JAVACMD" )
178 |
179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
180 | for arg do
181 | if
182 | case $arg in #(
183 | -*) false ;; # don't mess with options #(
184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185 | [ -e "$t" ] ;; #(
186 | *) false ;;
187 | esac
188 | then
189 | arg=$( cygpath --path --ignore --mixed "$arg" )
190 | fi
191 | # Roll the args list around exactly as many times as the number of
192 | # args, so each arg winds up back in the position where it started, but
193 | # possibly modified.
194 | #
195 | # NB: a `for` loop captures its iteration list before it begins, so
196 | # changing the positional parameters here affects neither the number of
197 | # iterations, nor the values presented in `arg`.
198 | shift # remove old arg
199 | set -- "$@" "$arg" # push replacement arg
200 | done
201 | fi
202 |
203 |
204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206 |
207 | # Collect all arguments for the java command:
208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209 | # and any embedded shellness will be escaped.
210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211 | # treated as '${Hostname}' itself on the command line.
212 |
213 | set -- \
214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
215 | -classpath "$CLASSPATH" \
216 | org.gradle.wrapper.GradleWrapperMain \
217 | "$@"
218 |
219 | # Stop when "xargs" is not available.
220 | if ! command -v xargs >/dev/null 2>&1
221 | then
222 | die "xargs is not available"
223 | fi
224 |
225 | # Use "xargs" to parse quoted args.
226 | #
227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228 | #
229 | # In Bash we could simply go:
230 | #
231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232 | # set -- "${ARGS[@]}" "$@"
233 | #
234 | # but POSIX shell has neither arrays nor command substitution, so instead we
235 | # post-process each arg (as a line of input to sed) to backslash-escape any
236 | # character that might be a shell metacharacter, then use eval to reverse
237 | # that process (while maintaining the separation between arguments), and wrap
238 | # the whole thing up as a single "set" statement.
239 | #
240 | # This will of course break if any of these variables contains a newline or
241 | # an unmatched quote.
242 | #
243 |
244 | eval "set -- $(
245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246 | xargs -n1 |
247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248 | tr '\n' ' '
249 | )" '"$@"'
250 |
251 | exec "$JAVACMD" "$@"
252 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment2/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | if ! command -v java >/dev/null 2>&1
137 | then
138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139 |
140 | Please set the JAVA_HOME variable in your environment to match the
141 | location of your Java installation."
142 | fi
143 | fi
144 |
145 | # Increase the maximum file descriptors if we can.
146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147 | case $MAX_FD in #(
148 | max*)
149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150 | # shellcheck disable=SC2039,SC3045
151 | MAX_FD=$( ulimit -H -n ) ||
152 | warn "Could not query maximum file descriptor limit"
153 | esac
154 | case $MAX_FD in #(
155 | '' | soft) :;; #(
156 | *)
157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158 | # shellcheck disable=SC2039,SC3045
159 | ulimit -n "$MAX_FD" ||
160 | warn "Could not set maximum file descriptor limit to $MAX_FD"
161 | esac
162 | fi
163 |
164 | # Collect all arguments for the java command, stacking in reverse order:
165 | # * args from the command line
166 | # * the main class name
167 | # * -classpath
168 | # * -D...appname settings
169 | # * --module-path (only if needed)
170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171 |
172 | # For Cygwin or MSYS, switch paths to Windows format before running java
173 | if "$cygwin" || "$msys" ; then
174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176 |
177 | JAVACMD=$( cygpath --unix "$JAVACMD" )
178 |
179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
180 | for arg do
181 | if
182 | case $arg in #(
183 | -*) false ;; # don't mess with options #(
184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185 | [ -e "$t" ] ;; #(
186 | *) false ;;
187 | esac
188 | then
189 | arg=$( cygpath --path --ignore --mixed "$arg" )
190 | fi
191 | # Roll the args list around exactly as many times as the number of
192 | # args, so each arg winds up back in the position where it started, but
193 | # possibly modified.
194 | #
195 | # NB: a `for` loop captures its iteration list before it begins, so
196 | # changing the positional parameters here affects neither the number of
197 | # iterations, nor the values presented in `arg`.
198 | shift # remove old arg
199 | set -- "$@" "$arg" # push replacement arg
200 | done
201 | fi
202 |
203 |
204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206 |
207 | # Collect all arguments for the java command:
208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209 | # and any embedded shellness will be escaped.
210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211 | # treated as '${Hostname}' itself on the command line.
212 |
213 | set -- \
214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
215 | -classpath "$CLASSPATH" \
216 | org.gradle.wrapper.GradleWrapperMain \
217 | "$@"
218 |
219 | # Stop when "xargs" is not available.
220 | if ! command -v xargs >/dev/null 2>&1
221 | then
222 | die "xargs is not available"
223 | fi
224 |
225 | # Use "xargs" to parse quoted args.
226 | #
227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228 | #
229 | # In Bash we could simply go:
230 | #
231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232 | # set -- "${ARGS[@]}" "$@"
233 | #
234 | # but POSIX shell has neither arrays nor command substitution, so instead we
235 | # post-process each arg (as a line of input to sed) to backslash-escape any
236 | # character that might be a shell metacharacter, then use eval to reverse
237 | # that process (while maintaining the separation between arguments), and wrap
238 | # the whole thing up as a single "set" statement.
239 | #
240 | # This will of course break if any of these variables contains a newline or
241 | # an unmatched quote.
242 | #
243 |
244 | eval "set -- $(
245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246 | xargs -n1 |
247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248 | tr '\n' ' '
249 | )" '"$@"'
250 |
251 | exec "$JAVACMD" "$@"
252 |
--------------------------------------------------------------------------------
/Unit1/code/Assignment3/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | if ! command -v java >/dev/null 2>&1
137 | then
138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139 |
140 | Please set the JAVA_HOME variable in your environment to match the
141 | location of your Java installation."
142 | fi
143 | fi
144 |
145 | # Increase the maximum file descriptors if we can.
146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147 | case $MAX_FD in #(
148 | max*)
149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150 | # shellcheck disable=SC2039,SC3045
151 | MAX_FD=$( ulimit -H -n ) ||
152 | warn "Could not query maximum file descriptor limit"
153 | esac
154 | case $MAX_FD in #(
155 | '' | soft) :;; #(
156 | *)
157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158 | # shellcheck disable=SC2039,SC3045
159 | ulimit -n "$MAX_FD" ||
160 | warn "Could not set maximum file descriptor limit to $MAX_FD"
161 | esac
162 | fi
163 |
164 | # Collect all arguments for the java command, stacking in reverse order:
165 | # * args from the command line
166 | # * the main class name
167 | # * -classpath
168 | # * -D...appname settings
169 | # * --module-path (only if needed)
170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171 |
172 | # For Cygwin or MSYS, switch paths to Windows format before running java
173 | if "$cygwin" || "$msys" ; then
174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176 |
177 | JAVACMD=$( cygpath --unix "$JAVACMD" )
178 |
179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
180 | for arg do
181 | if
182 | case $arg in #(
183 | -*) false ;; # don't mess with options #(
184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185 | [ -e "$t" ] ;; #(
186 | *) false ;;
187 | esac
188 | then
189 | arg=$( cygpath --path --ignore --mixed "$arg" )
190 | fi
191 | # Roll the args list around exactly as many times as the number of
192 | # args, so each arg winds up back in the position where it started, but
193 | # possibly modified.
194 | #
195 | # NB: a `for` loop captures its iteration list before it begins, so
196 | # changing the positional parameters here affects neither the number of
197 | # iterations, nor the values presented in `arg`.
198 | shift # remove old arg
199 | set -- "$@" "$arg" # push replacement arg
200 | done
201 | fi
202 |
203 |
204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206 |
207 | # Collect all arguments for the java command:
208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209 | # and any embedded shellness will be escaped.
210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211 | # treated as '${Hostname}' itself on the command line.
212 |
213 | set -- \
214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
215 | -classpath "$CLASSPATH" \
216 | org.gradle.wrapper.GradleWrapperMain \
217 | "$@"
218 |
219 | # Stop when "xargs" is not available.
220 | if ! command -v xargs >/dev/null 2>&1
221 | then
222 | die "xargs is not available"
223 | fi
224 |
225 | # Use "xargs" to parse quoted args.
226 | #
227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228 | #
229 | # In Bash we could simply go:
230 | #
231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232 | # set -- "${ARGS[@]}" "$@"
233 | #
234 | # but POSIX shell has neither arrays nor command substitution, so instead we
235 | # post-process each arg (as a line of input to sed) to backslash-escape any
236 | # character that might be a shell metacharacter, then use eval to reverse
237 | # that process (while maintaining the separation between arguments), and wrap
238 | # the whole thing up as a single "set" statement.
239 | #
240 | # This will of course break if any of these variables contains a newline or
241 | # an unmatched quote.
242 | #
243 |
244 | eval "set -- $(
245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246 | xargs -n1 |
247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248 | tr '\n' ' '
249 | )" '"$@"'
250 |
251 | exec "$JAVACMD" "$@"
252 |
--------------------------------------------------------------------------------