From 09e477c33ad7a5fdb64831eb97e3bb5209048c6c Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Wed, 25 Jan 2023 16:04:51 -0500 Subject: [PATCH 1/5] Created Textbook annotation. --- src/main/java/meta/Textbook.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/java/meta/Textbook.java diff --git a/src/main/java/meta/Textbook.java b/src/main/java/meta/Textbook.java new file mode 100644 index 0000000..1fa2f24 --- /dev/null +++ b/src/main/java/meta/Textbook.java @@ -0,0 +1,10 @@ +package meta; + +import java.lang.annotation.*; + +@Documented +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +@Retention(RetentionPolicy.SOURCE) +public @interface Textbook { + int page() default -1; +} From 830221c0c5efa3c148053e11523da329cc179828 Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Wed, 25 Jan 2023 17:00:31 -0500 Subject: [PATCH 2/5] Updated README.md. --- README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7b51bb7..87ac5c9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ +*Read this in its entirety before using this repository.* + ![Logo](src/main/res/Logo.png) ### Forward - All programs assigned from the *Java Methods Object-Oriented Programming and Data Structures* textbook. - - The `.java` files are provided for all programs assigned in Mr. Tenzca's AP Computer Science A class from 2021-2022. +All programs assigned from the *Java Methods Object-Oriented Programming and Data Structures* textbook. - >Benevolently provided *for the benefit of humankind and confused students* 😝. +The `.java` files are provided for all programs assigned in Mr. Tenzca's AP Computer Science A class from 2021-2022. + +> Benevolently provided *for the benefit of humankind and confused students* 😝. ### Contents All programs are contained in packages in the `src` module. Packages are structured as `chapter##.exercisename`. @@ -21,9 +23,86 @@ All programs are contained in packages in the `src` module. Packages are structu - `Chapter 11 - Class Hierarchies and Interfaces` - `Chapter 12 - Arrays` - `Chapter 13 - ArrayLists` - + ### ⚠ Warnings ⚠ - Although this GitHub Repository may provide nearly all the programs necessitated for the majority of the class (as of 2021's class), actually completing the programs by yourself is always the best way to succeed. These programs are intended as **reference-only** and no personal responsibility is taken for the contents of the code. Attempt to code the solutions yourself, and only if you are lost should you attempt to integrate and modify certain aspects of this repository into your own code. You should understand exactly what each line of code does before implementing it into your program. Asking others for help is always the best solution. +All programs should be accurate for each exercise and understandable for the current level. However, there may be a few +minor differences between the code provided and "acceptable" code. + +> ⓘ   If you find that some segments of code in a certain chapter haven't been taught yet, open an issue and +> report it to us. + +#### Documentation +Firstly, newer programs for this repository contain documentation comments like this: + +```java +/** +* Constructs a {@link Time} by hours and minutes using military time, e.g., 23:00 instead of 11:00 PM. +* @param hours The hour of day. Defaults to zero if an hour not between 0 and 23 is not given. +* @param minutes The minute. Defaults to zero if a minute not between 0 and 59 is not given. +*/ +public Time(int hours, int minutes) { + ... +} +``` + +In real-world programs, these are used to explain purposes and usages of classes, methods or what have you. Here, they +are used to help explain solutions and provide better help in understanding why or how code was written. + +For similar purposes, some programs will have code comments to explain reasons for strange or new techniques such as +this: + +```java +String zero = ""; +if (minutes < 10) { + zero = "0"; // Add a zero with single-digit minutes, or else times can show up as 12:0 or 3:8. +} +``` + +> ⚠   Comments should not be included in your solutions as we have written them. + +#### Marked Textbook Code + +For purposes of clarity and maintainability of this repository, we have created a `@Textbook` annotation in the `meta` +package to mark code specifically written by and taken from the textbook. It is meant only for providing +meta-information to the viewer. It has no effect on program behavior. It can be seen attached to classes, methods and +constructors as such: + +```java +@Textbook +public class TestTime { + ... +} +``` + +Or, if it is included on a different page than marked in the chapter manifest, like this: + +```java +@Textbook(page = 142) +public static void main(String[] args) { + ... +} +``` + +> ⚠   The `@Textbook` annotation should **never** be included with your solutions. + +#### Disclaimer + +Although this GitHub repository may provide nearly all the programs necessitated for the majority of the class (as of +2021's class), actually completing the programs by yourself is always the best way to succeed. + +These programs are intended as **reference-only** and no personal responsibility is taken for the contents of the code. +It is the responsibility of the user to develop the skills needed to make these programs and understand the underlying +principles behind them. + +It is our recommendation that you code the solutions yourself, and only if you are lost that you attempt to integrate +and modify certain aspects of this repository into your own code. You should understand exactly what each line of code +does before implementing it into your program. + +Remember, asking others for help is always the best solution. ![SampleCode](src/main/res/CodeSample.png) ![SampleCode2](src/main/res/CodeSample2.png) + +### Contributors +- [Ethan Koh](https://github.com/ArsiaC01), creator and lead developer +- [awesomegamergame](https://github.com/awesomegamergame), developer \ No newline at end of file From aee13168ddc734b496cfab4f7c8f7ebd930d7bf4 Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Wed, 25 Jan 2023 20:02:17 -0500 Subject: [PATCH 3/5] Added documentation to @Textbook. --- src/main/java/meta/Textbook.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/meta/Textbook.java b/src/main/java/meta/Textbook.java index 1fa2f24..259bc3a 100644 --- a/src/main/java/meta/Textbook.java +++ b/src/main/java/meta/Textbook.java @@ -2,6 +2,13 @@ import java.lang.annotation.*; +/** + * Denotes that the declaration which this annotates and all of its children (e.g., the methods and constructors of a + * class) are provided directly by the textbook and are not to be modified. + *

+ * If this code fragment appears on a page different from the exercise written in the chapter manifest, + * it should be passed as an argument to the page parameter. + */ @Documented @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) @Retention(RetentionPolicy.SOURCE) From 400bb791254295425c87a201241c4d60a584f662 Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Wed, 25 Jan 2023 20:02:17 -0500 Subject: [PATCH 4/5] Added documentation to @Textbook. --- src/main/java/meta/Textbook.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/meta/Textbook.java b/src/main/java/meta/Textbook.java index 1fa2f24..259bc3a 100644 --- a/src/main/java/meta/Textbook.java +++ b/src/main/java/meta/Textbook.java @@ -2,6 +2,13 @@ import java.lang.annotation.*; +/** + * Denotes that the declaration which this annotates and all of its children (e.g., the methods and constructors of a + * class) are provided directly by the textbook and are not to be modified. + *

+ * If this code fragment appears on a page different from the exercise written in the chapter manifest, + * it should be passed as an argument to the page parameter. + */ @Documented @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) @Retention(RetentionPolicy.SOURCE) From afbe91ab6b0f26b8ab6dbe6d3f5fd4d57e5e107a Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Fri, 27 Jan 2023 11:19:47 -0500 Subject: [PATCH 5/5] Made small fixes to and suppressed errors in README.md. --- README.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 87ac5c9..bf24bff 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ The `.java` files are provided for all programs assigned in Mr. Tenzca's AP Comp ### Contents All programs are contained in packages in the `src` module. Packages are structured as `chapter##.exercisename`. + - `Chapter 2 - An Introduction to Software Engineering` - `Chapter 3 - Objects and Classes` - `Chapter 4 - Algorithms` @@ -24,6 +25,10 @@ All programs are contained in packages in the `src` module. Packages are structu - `Chapter 12 - Arrays` - `Chapter 13 - ArrayLists` +Each chapter package contains a chapter manifest file named `Chapter ##.md` (e.g., for Chapter 11, +[`Chapter 11.md`](src/main/java/chapter11/Chapter%2011.md)). These document the chapter, a table of the exercises +covered and the package each is contained in, and the contributors to that chapter. + ### ⚠ Warnings ⚠ All programs should be accurate for each exercise and understandable for the current level. However, there may be a few minor differences between the code provided and "acceptable" code. @@ -36,20 +41,22 @@ Firstly, newer programs for this repository contain documentation comments like ```java /** -* Constructs a {@link Time} by hours and minutes using military time, e.g., 23:00 instead of 11:00 PM. -* @param hours The hour of day. Defaults to zero if an hour not between 0 and 23 is not given. -* @param minutes The minute. Defaults to zero if a minute not between 0 and 59 is not given. -*/ + * Constructs a {@link Time} by hours and minutes using military time, e.g., 23:00 instead of 11:00 PM. + * + * @param hours The hour of day. Defaults to zero if an hour not between 0 and 23 is not given. + * @param minutes The minute. Defaults to zero if a minute not between 0 and 59 is not given. + */ public Time(int hours, int minutes) { ... -} +} ``` In real-world programs, these are used to explain purposes and usages of classes, methods or what have you. Here, they -are used to help explain solutions and provide better help in understanding why or how code was written. +are used to help explain solutions and provide better help in understanding why or how code was written. It can be +viewed in plaintext, but it is better viewed in an IDE like IntelliJ IDEA. -For similar purposes, some programs will have code comments to explain reasons for strange or new techniques such as -this: +For similar purposes, some programs will have code comments to explain reasons for potentially unclear or strange code +like this: ```java String zero = "";