From 57ac7f37e8e8a387c98ab0f27f22e25a7d44c1de Mon Sep 17 00:00:00 2001 From: KseniaTk Date: Mon, 16 Sep 2024 13:44:51 -0400 Subject: [PATCH 1/3] Finished TASK 1 TODO --- README.md | 8 ++++---- src/DataTypes.java | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8207214b..d9962a78 100644 --- a/README.md +++ b/README.md @@ -24,19 +24,19 @@ can make pull requests to that repo during the Task 3 activity during the lab. During lab, you should not fork directly from https://github.com/CSC207-2024F-UofT/Lab2. If you miss the lab and work on this after, you should use this URL though. -- [ ] Make a fork of this repo and clone a local copy (as you did in Lab 1). +- [X] Make a fork of this repo and clone a local copy (as you did in Lab 1). - **Important**: make sure to uncheck the option to only fork the main branch, as the repo contains two branches you will use later in this lab. # TASK 1: Your first branch -- [ ] Create and checkout a new branch called `task_1` using either IntelliJ or the Terminal: +- [X] Create and checkout a new branch called `task_1` using either IntelliJ or the Terminal: - IntelliJ: `Git -> New branch...` - Terminal: `git checkout -b task_1` - After, you can check `git status` or the Log tab of the Git tool window in IntelliJ to see that you are now on the `task_1` branch. -- [ ] Open the TODO tool window (`View -> Tool Windows -> TODO`) and click on the TASK 1 TODO listed. -- [ ] Complete the TASK 1 TODO and commit your changes to this file (checking off the +- [X] Open the TODO tool window (`View -> Tool Windows -> TODO`) and click on the TASK 1 TODO listed. +- [X] Complete the TASK 1 TODO and commit your changes to this file (checking off the completed items so far) and `DataTypes.java` (remove the word TODO and your bug fix). - talk to those around you or your TA, then see the hints at the bottom of the readme if you get stuck. - [ ] Now, we'll merge the `task_1` branch back into `main`. When merging, diff --git a/src/DataTypes.java b/src/DataTypes.java index 4f807c1f..8deac740 100644 --- a/src/DataTypes.java +++ b/src/DataTypes.java @@ -1,14 +1,18 @@ import java.util.List; public class DataTypes { - // TODO TASK 1: fix this code so that it passes the test in DataTypesTest.java + // TASK 1: fix this code so that it passes the test in DataTypesTest.java public static long sum(List numbers) { int s = 0; // below is a "foreach" loop which iterates through numbers for (int x : numbers) { + s += x; + } return s; } + + } From 241a14dcf516a1e53d15617d9ffddd877fa06e05 Mon Sep 17 00:00:00 2001 From: KseniaTk Date: Mon, 16 Sep 2024 13:45:09 -0400 Subject: [PATCH 2/3] added package --- test/DataTypesTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/DataTypesTest.java b/test/DataTypesTest.java index 42b9ef96..71a06714 100644 --- a/test/DataTypesTest.java +++ b/test/DataTypesTest.java @@ -13,6 +13,8 @@ public class DataTypesTest { * Test that DataTypes.sum returns the correct value for * the sum from 1 to 1 million. */ + + public void largeSumTest() { // You put an L at the end to indicate it is a long. @@ -27,4 +29,6 @@ public void largeSumTest() { } assertEquals("sum from 1 to 1 million should be " + x, x, DataTypes.sum(lst)); } + + } From 3a6894bd16b0e532e832af535b9dc3c158bba28d Mon Sep 17 00:00:00 2001 From: KseniaTk Date: Mon, 16 Sep 2024 13:48:19 -0400 Subject: [PATCH 3/3] checked off item --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d9962a78..bff72102 100644 --- a/README.md +++ b/README.md @@ -39,23 +39,23 @@ If you miss the lab and work on this after, you should use this URL though. - [X] Complete the TASK 1 TODO and commit your changes to this file (checking off the completed items so far) and `DataTypes.java` (remove the word TODO and your bug fix). - talk to those around you or your TA, then see the hints at the bottom of the readme if you get stuck. -- [ ] Now, we'll merge the `task_1` branch back into `main`. When merging, +- [X] Now, we'll merge the `task_1` branch back into `main`. When merging, you need to be currently on the branch you are trying to merge into, so we'll first checkout the main branch: - IntelliJ: `Git -> branches... -> main -> Checkout` - Terminal: `git checkout main` Note: everything we've done has been local to our repository and have not pushed anything yet. -- [ ] We are back on `main`, so we can now do the merge and complete our work! +- [X] We are back on `main`, so we can now do the merge and complete our work! - IntelliJ: `Git -> Merge... -> task_1 -> Merge` - Terminal: `git merge task_1` You should now see the changes you had made are also in the `main` branch. -- [ ] Now, we'll want to clean up since we are done with our `task_1` branch. +- [X] Now, we'll want to clean up since we are done with our `task_1` branch. - IntelliJ: `Git -> branches... -> task_1 -> Delete` - Terminal: `git branch -d task_1` -- [ ] Last step, we'll push our changes to the remote repository to share our work! (As we did in Lab 1.) +- [X] Last step, we'll push our changes to the remote repository to share our work! (As we did in Lab 1.) - we suggest you check off this last item, commit that change (just right on the main branch is fine; no need to branch for this little step), then push your code. Check GitHub to ensure you can see your changes.