From ac56dfafd0176f6c6e5d92f62cda3fa558d67a97 Mon Sep 17 00:00:00 2001 From: Carsten Gips Date: Fri, 8 Mar 2024 16:10:50 +0100 Subject: [PATCH] add files for zoo task add link to task (readme) --- README.md | 53 +++---------------- src/main/java/zoo/Animal.java | 14 +++++ src/main/java/zoo/fishes/Fish.java | 11 ++++ src/main/java/zoo/mammals/Mammal.java | 11 ++++ src/main/java/zoo/mammals/cats/Cat.java | 6 +++ .../java/zoo/mammals/primates/Primate.java | 6 +++ src/main/java/zoo/mammals/rodents/Rodent.java | 6 +++ src/main/java/zoo/reptiles/Reptile.java | 11 ++++ src/test/java/.gitkeep | 0 9 files changed, 72 insertions(+), 46 deletions(-) create mode 100644 src/main/java/zoo/Animal.java create mode 100644 src/main/java/zoo/fishes/Fish.java create mode 100644 src/main/java/zoo/mammals/Mammal.java create mode 100644 src/main/java/zoo/mammals/cats/Cat.java create mode 100644 src/main/java/zoo/mammals/primates/Primate.java create mode 100644 src/main/java/zoo/mammals/rodents/Rodent.java create mode 100644 src/main/java/zoo/reptiles/Reptile.java delete mode 100644 src/test/java/.gitkeep diff --git a/README.md b/README.md index 1c7ad98..52a4848 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,19 @@ --- -title: Student Support Code Template +title: "Student Support Code for 'Zoo' Task" --- ## About -This is a template repo for providing student support code (e.g. source code and tests) for -Java based homework assignments. - -It comes with batteries included: - -- [Gradle 8.6] preinstalled -- Basic Gradle configuration: - - [JDK 21] based projects - - Default [Gradle Java project layout] - - [JUnit 5] for software testing - - [Checkstyle] to check for valid Javadoc comments for all `public` elements in source - code - - [Spotless] to check formatting of Java code using the [Google Java Style Guide], can - also format sources if necessary -- [GitHub workflow] to build and test the project in [GitHub CI], check sources with - Checkstyle and Spotless -- [Dependabot] to keep dependencies (GitHub workflow, Gradle configuration) up to date - -## Usage - -This repo is intended to be used as a template repo. To create new repos for assignments, the -following steps may help: - -1. Fork this repo or use it as a template to create a new repo. -2. Add the required source code, tests and task descriptions to your new repo. -3. If needed, adjust the Gradle configuration to your needs. -4. Make your new repo available to the students. - -If desired, activate the GitHub CI in your new repo (under "*Settings \> Actions \> General \> -Allow actions*"). You need to allow at least the following actions: `actions/checkout@v4` and -`actions/setup-java@v4`. +This represents the student support code for the [Zoo task]. ## License This [work] by [Carsten Gips] and [contributors] is licensed under [MIT]. - [Gradle 8.6]: https://docs.gradle.org/8.6/release-notes.html - [JDK 21]: https://jdk.java.net/21/ - [Gradle Java project layout]: https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout - [JUnit 5]: https://junit.org/junit5/ - [Checkstyle]: https://github.com/checkstyle/checkstyle - [Spotless]: https://github.com/diffplug/spotless - [Google Java Style Guide]: https://google.github.io/styleguide/javaguide.html - [GitHub workflow]: https://docs.github.com/en/get-started/using-github/github-flow - [GitHub CI]: https://docs.github.com/en/actions/automating-builds-and-tests/about-continuous-integration - [Dependabot]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot - [work]: https://github.com/Programmiermethoden-CampusMinden/student-support-code-template - [Carsten Gips]: https://github.com/cagix - [contributors]: https://github.com/Programmiermethoden-CampusMinden/student-support-code-template/graphs/contributors - [MIT]: LICENSE.md +[Zoo task]: https://github.com/Programmiermethoden-CampusMinden/Prog2-Lecture/blob/master/homework/b02.md +[work]: https://github.com/Programmiermethoden-CampusMinden/prog2_ybel_zoo +[Carsten Gips]: https://github.com/cagix +[contributors]: https://github.com/Programmiermethoden-CampusMinden/prog2_ybel_zoo/graphs/contributors +[MIT]: LICENSE.md diff --git a/src/main/java/zoo/Animal.java b/src/main/java/zoo/Animal.java new file mode 100644 index 0000000..19917e1 --- /dev/null +++ b/src/main/java/zoo/Animal.java @@ -0,0 +1,14 @@ +package zoo; + +/** Describes the shared features of every animal. */ +public interface Animal { + /** + * Every creature has a name. + * + * @return the name of the animal + */ + String getName(); + + /** Creatures can move around. */ + void move(); +} diff --git a/src/main/java/zoo/fishes/Fish.java b/src/main/java/zoo/fishes/Fish.java new file mode 100644 index 0000000..1e66b29 --- /dev/null +++ b/src/main/java/zoo/fishes/Fish.java @@ -0,0 +1,11 @@ +package zoo.fishes; + +import zoo.Animal; + +/** Fish form an animal class. */ +public interface Fish extends Animal { + /** Our fish can swim by using the move method. */ + default void swim() { + move(); + } +} diff --git a/src/main/java/zoo/mammals/Mammal.java b/src/main/java/zoo/mammals/Mammal.java new file mode 100644 index 0000000..57af02a --- /dev/null +++ b/src/main/java/zoo/mammals/Mammal.java @@ -0,0 +1,11 @@ +package zoo.mammals; + +import zoo.Animal; + +/** Mammals form an animal class. */ +public interface Mammal extends Animal { + /** Our mammals can run around by using the move method. */ + default void run() { + move(); + } +} diff --git a/src/main/java/zoo/mammals/cats/Cat.java b/src/main/java/zoo/mammals/cats/Cat.java new file mode 100644 index 0000000..a9cc587 --- /dev/null +++ b/src/main/java/zoo/mammals/cats/Cat.java @@ -0,0 +1,6 @@ +package zoo.mammals.cats; + +import zoo.mammals.Mammal; + +/** The cat family belongs to the class of mammals. */ +public interface Cat extends Mammal {} diff --git a/src/main/java/zoo/mammals/primates/Primate.java b/src/main/java/zoo/mammals/primates/Primate.java new file mode 100644 index 0000000..1eaff57 --- /dev/null +++ b/src/main/java/zoo/mammals/primates/Primate.java @@ -0,0 +1,6 @@ +package zoo.mammals.primates; + +import zoo.mammals.Mammal; + +/** The order of primates belongs to the class of mammals. */ +public interface Primate extends Mammal {} diff --git a/src/main/java/zoo/mammals/rodents/Rodent.java b/src/main/java/zoo/mammals/rodents/Rodent.java new file mode 100644 index 0000000..a850eab --- /dev/null +++ b/src/main/java/zoo/mammals/rodents/Rodent.java @@ -0,0 +1,6 @@ +package zoo.mammals.rodents; + +import zoo.mammals.Mammal; + +/** The order of rodents belongs to the class of mammals. */ +public interface Rodent extends Mammal {} diff --git a/src/main/java/zoo/reptiles/Reptile.java b/src/main/java/zoo/reptiles/Reptile.java new file mode 100644 index 0000000..eec9674 --- /dev/null +++ b/src/main/java/zoo/reptiles/Reptile.java @@ -0,0 +1,11 @@ +package zoo.reptiles; + +import zoo.Animal; + +/** Reptiles form an animal class. */ +public interface Reptile extends Animal { + /** Our reptiles can crawl by using the move method. */ + default void crawl() { + move(); + } +} diff --git a/src/test/java/.gitkeep b/src/test/java/.gitkeep deleted file mode 100644 index e69de29..0000000