From e046daa4145aaabd77fc48b0a19d03f329b60895 Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:06:08 -0400 Subject: [PATCH 1/6] comments to understand code --- test/DataTypesTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/DataTypesTest.java b/test/DataTypesTest.java index 42b9ef96..b3b3c9b0 100644 --- a/test/DataTypesTest.java +++ b/test/DataTypesTest.java @@ -20,11 +20,14 @@ public void largeSumTest() { // saying "Integer number too large". // Note: You can use _ to help make it easier to // read large numbers, as is done below. - long x = 500_000_500_000L; - List lst = new ArrayList<>(); - for (int i = 1; i <= 1_000_000; i++) { - lst.add(i); - } + long x = 500_000_500_000L; // defining data type of x as a long used to represent large numbers + List lst = new ArrayList<>(); // declaring and assigning variable lst to an empty Array + for (int i = 1; i <= 1_000_000; i++) { // looping through from 1 to 1 million + lst.add(i); // adding number to lst + + } // makes a list of numbers from 1 to 1 million assertEquals("sum from 1 to 1 million should be " + x, x, DataTypes.sum(lst)); } + + // why is sum different } From e04cf1690d8d407b9154c3b83e4463d63c2ebf7c Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:06:40 -0400 Subject: [PATCH 2/6] fixed code to pass test in DataTypes.java --- src/DataTypes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DataTypes.java b/src/DataTypes.java index 4f807c1f..3f61a2a3 100644 --- a/src/DataTypes.java +++ b/src/DataTypes.java @@ -4,9 +4,9 @@ public class DataTypes { // TODO TASK 1: fix this code so that it passes the test in DataTypesTest.java public static long sum(List numbers) { - int s = 0; + long s = 0; // below is a "foreach" loop which iterates through numbers - for (int x : numbers) { + for (long x : numbers) { s += x; } return s; From 3319fb79b4db8d56ef73ba654fcf09898d77a35a Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:07:14 -0400 Subject: [PATCH 3/6] checked off completed items --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8207214b..bff72102 100644 --- a/README.md +++ b/README.md @@ -24,38 +24,38 @@ 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, +- [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. From 5108434f5d36dba116ad8dac5f90401c06794a6a Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:21:50 -0400 Subject: [PATCH 4/6] checked off completed items --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bff72102..074c2f0c 100644 --- a/README.md +++ b/README.md @@ -76,17 +76,17 @@ started working on the recipe in `recipe.md` together, and then each filled in t what they felt would make the most delicious cake! You'll notice that your repository already has two branches called `alice` and `bob`. -- [ ] Checkout the `alice` branch. -- [ ] Attempt to merge the `bob` branch into the `alice` branch using either IntelliJ or the Terminal. +- [X] Checkout the `alice` branch. +- [X] Attempt to merge the `bob` branch into the `alice` branch using either IntelliJ or the Terminal. - You will be prompted to resolve a merge conflict. To do this, you will need to pick and choose which parts of each recipe to keep. - Read what either `git` or `IntelliJ` tells you in order to complete the merge process. - If you do the merge through the Terminal, you will need to edit `recipe.md` to remove all of the merge conflict symbols which `git` has added to your file. Once done, you will need to `git add` the `recipe.md` file and `git commit` to finish the merge. -- [ ] Once the merge is complete, delete the `bob` branch. +- [X] Once the merge is complete, delete the `bob` branch. -- [ ] Finally, checkout the `main` branch and merge the `alice` branch in (as we did previously). +- [X] Finally, checkout the `main` branch and merge the `alice` branch in (as we did previously). Now, you are almost ready to share your recipe with the remote! From cb84d6788384dead23cf82114ec69c2d910329a2 Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:23:22 -0400 Subject: [PATCH 5/6] added extra instructions --- recipe.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipe.md b/recipe.md index 21b934ef..9197fdc5 100644 --- a/recipe.md +++ b/recipe.md @@ -21,6 +21,9 @@ 7. Gradually add the milk and vegetable oil to the mixture, continuing to stir. 8. Line the bottom of the baking pan with parchment paper for easy cake removal. 9. Pour the batter into a greased and floured 9x13-inch baking pan. +10. Bake for 35 minutes or until soft. +11. Serve in a glass Pyrex bowl and let cool down for 15 minutes + From aa675853e747fdd264a0ab7cb90c920c303555f5 Mon Sep 17 00:00:00 2001 From: Amazing Lawal Date: Mon, 16 Sep 2024 12:24:29 -0400 Subject: [PATCH 6/6] ticked off completed items --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 074c2f0c..11283af1 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,10 @@ Now, you are almost ready to share your recipe with the remote! # TASK 3 -- [ ] Checkout a new branch called `task_3`. -- [ ] Commit any changes that you want to `recipe.md` to further improve the recipe. -- [ ] While still on the `task_3` branch, push your code to your remote repository on GitHub. -- [ ] Go to GitHub and you will see an option to make a pull request to the original repo. Make +- [X] Checkout a new branch called `task_3`. +- [X] Commit any changes that you want to `recipe.md` to further improve the recipe. +- [X] While still on the `task_3` branch, push your code to your remote repository on GitHub. +- [X] Go to GitHub and you will see an option to make a pull request to the original repo. Make a pull request and see that it shows up in the original repository that you forked. Since others will also be making pull requests, we won't *actually* accept any of them for now, but