diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..156ad59 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,11 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Fudge" + given-names: "Michael" + orcid: "https://orcid.org/0009-0006-2760-9360" +title: "LearnJava: Code samples and exercises for learning Java" +version: v3.0.0 +doi: 10.5281/zenodo.10607299 +date-released: 2014-07-30 +url: "https://github.com/mafudge/LearnJava" \ No newline at end of file diff --git a/Lesson-02/Activities/ChallengeActivity1-AreaAndPerimeterOfARectangle/src/areaandperimeterofarectangle/AreaAndPerimeterOfARectangle.java b/Lesson-02/Activities/ChallengeActivity1-AreaAndPerimeterOfARectangle/src/areaandperimeterofarectangle/AreaAndPerimeterOfARectangle.java index b898fc2..8e235ea 100644 --- a/Lesson-02/Activities/ChallengeActivity1-AreaAndPerimeterOfARectangle/src/areaandperimeterofarectangle/AreaAndPerimeterOfARectangle.java +++ b/Lesson-02/Activities/ChallengeActivity1-AreaAndPerimeterOfARectangle/src/areaandperimeterofarectangle/AreaAndPerimeterOfARectangle.java @@ -6,7 +6,7 @@ * the area and perimeter of the recrangle. * * Area = Length x Width - * Perimeter 2 x Length x Width + * Perimeter = 2 x (Length + Width) * * SAMPLE RUN: * Enter Length: 7 @@ -24,7 +24,7 @@ public class AreaAndPerimeterOfARectangle { public static void main(String[] args) { // declare variables - // get length and with inputs + // get length and width with inputs // perform area, perimeter calculations diff --git a/Lesson-03/SOLUTIONS/Solution-ChallengeActivity2-DegreesOfATriangle/src/degreesofatriangle/DegreesOfATriangle.java b/Lesson-03/SOLUTIONS/Solution-ChallengeActivity2-DegreesOfATriangle/src/degreesofatriangle/DegreesOfATriangle.java index 431f32f..bb84e17 100644 --- a/Lesson-03/SOLUTIONS/Solution-ChallengeActivity2-DegreesOfATriangle/src/degreesofatriangle/DegreesOfATriangle.java +++ b/Lesson-03/SOLUTIONS/Solution-ChallengeActivity2-DegreesOfATriangle/src/degreesofatriangle/DegreesOfATriangle.java @@ -29,7 +29,7 @@ public static void main(String[] args) { Scanner input= new Scanner(System.in); System.out.print("Enter degrees for angle 1 : "); a1 = input.nextInt(); - System.out.print("Enter degrees for angle 3 : "); + System.out.print("Enter degrees for angle 2 : "); a2 = input.nextInt(); System.out.print("Enter degrees for angle 3 : "); a3 = input.nextInt(); diff --git a/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java b/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java index 546fa80..9abad90 100644 --- a/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java +++ b/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java @@ -57,32 +57,12 @@ SAMPLE RUN (three invalid attempts) public class ATM { public static void main(String[] args) { - //TODO: Write your code here. System.out.printf("*********************************\n"); System.out.printf("*** Welcome to FudgeBank ATM! ***\n"); System.out.printf("*********************************\n\n"); Scanner input = new Scanner(System.in); - BankAccount myacct = new BankAccount("1234", 500); - int attempts = 0; - boolean success= false; - while(true) { - System.out.print("Enter PIN # ==> "); - String pin = input.nextLine(); - attempts++; - if (pin.equals(myacct.Pin())) { - success = true; - break; - } - if (attempts >= 3) { - success = false; - break; - } - } - if (success) { - menu(); - } else { - System.out.println("You entered an invalid pin 3 times!"); - } + //TODO: Write your code here. + } public static void menu() { diff --git a/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java b/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java index 96ecc58..a215a79 100644 --- a/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java +++ b/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java @@ -62,7 +62,28 @@ public static void main(String[] args) { System.out.printf("*********************************\n\n"); Scanner input = new Scanner(System.in); //TODO: Write your code here. - + BankAccount myacct = new BankAccount("1234", 500); + int attempts = 0; + boolean success= false; + while(true) { + System.out.print("Enter PIN # ==> "); + String pin = input.nextLine(); + attempts++; + if (pin.equals(myacct.Pin())) { + success = true; + break; + } + if (attempts >= 3) { + success = false; + break; + } + } + if (success) { + menu(); + } else { + System.out.println("You entered an invalid pin 3 times!"); + } + } /** main menu of ATM */ diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/build.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/build.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/build.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/build.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/manifest.mf b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/manifest.mf similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/manifest.mf rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/manifest.mf diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.properties b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.properties similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.properties rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.properties diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/build.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/build.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/build.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/build.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/manifest.mf b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/manifest.mf similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/manifest.mf rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/manifest.mf diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java diff --git a/README.md b/README.md index 6861402..8e9a0b6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # LearnJava +[![DOI](https://zenodo.org/badge/11675734.svg)](https://zenodo.org/doi/10.5281/zenodo.10607299) + + This repository contains code samples and exercises to support the **Learn to Program in Java** video series. [Here's a link to the series on YouTube](https://www.youtube.com/playlist?list=PLyRiRUsTyUXhUXoOPEdMZWhGpGeSQFZgH)