From caecdfb60381e1c9febe8e0dd26d45e7242f4063 Mon Sep 17 00:00:00 2001
From: Dustin Dev <94726570+dustinFriesenDev@users.noreply.github.com>
Date: Sun, 20 Aug 2023 08:19:33 -0400
Subject: [PATCH 01/15] Finished studio without bonus
---
.../collections-exercises/.gitignore | 38 +++++++++++++++++++
.../exercises/collections-exercises/pom.xml | 17 +++++++++
.../src/main/java/org/example/Main.java | 19 ++++++++++
.../java/org/launchcode/AlicesAdventures.java | 31 +++++++++++++++
.../main/java/org/launchcode/HelloWorld.java | 14 +++++++
.../main/java/org/launchcode/InputOutput.java | 4 ++
.../java/org/launchcode/MilesPerGallon.java | 17 +++++++++
.../java/org/launchcode/RectangleArea.java | 19 ++++++++++
.../src/main/java/org/launchcode/Area.java | 17 +++++++++
.../java/studios/areaofacircle/Circle.java | 7 ++++
10 files changed, 183 insertions(+)
create mode 100644 control-flow-and-collections/exercises/collections-exercises/.gitignore
create mode 100644 control-flow-and-collections/exercises/collections-exercises/pom.xml
create mode 100644 control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
create mode 100644 datatypes/datatypes-exercises/src/main/java/org/launchcode/AlicesAdventures.java
create mode 100644 datatypes/datatypes-exercises/src/main/java/org/launchcode/HelloWorld.java
create mode 100644 datatypes/datatypes-exercises/src/main/java/org/launchcode/InputOutput.java
create mode 100644 datatypes/datatypes-exercises/src/main/java/org/launchcode/MilesPerGallon.java
create mode 100644 datatypes/datatypes-exercises/src/main/java/org/launchcode/RectangleArea.java
create mode 100644 datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
create mode 100644 datatypes/datatypes-studio/src/main/java/studios/areaofacircle/Circle.java
diff --git a/control-flow-and-collections/exercises/collections-exercises/.gitignore b/control-flow-and-collections/exercises/collections-exercises/.gitignore
new file mode 100644
index 000000000..5ff6309b7
--- /dev/null
+++ b/control-flow-and-collections/exercises/collections-exercises/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/control-flow-and-collections/exercises/collections-exercises/pom.xml b/control-flow-and-collections/exercises/collections-exercises/pom.xml
new file mode 100644
index 000000000..d69c9ebac
--- /dev/null
+++ b/control-flow-and-collections/exercises/collections-exercises/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ org.example
+ untitled
+ 1.0-SNAPSHOT
+
+
+ 17
+ 17
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java b/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
new file mode 100644
index 000000000..910825b48
--- /dev/null
+++ b/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
@@ -0,0 +1,19 @@
+package org.example;
+
+// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
+// then press Enter. You can now see whitespace characters in your code.
+public class Main {
+ public static void main(String[] args) {
+ // Press Alt+Enter with your caret at the highlighted text to see how
+ // IntelliJ IDEA suggests fixing it.
+ System.out.printf("Hello and welcome!");
+
+ // Press Shift+F10 or click the green arrow button in the gutter to run the code.
+ for (int i = 1; i <= 5; i++) {
+
+ // Press Shift+F9 to start debugging your code. We have set one breakpoint
+ // for you, but you can always add more by pressing Ctrl+F8.
+ System.out.println("i = " + i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/datatypes/datatypes-exercises/src/main/java/org/launchcode/AlicesAdventures.java b/datatypes/datatypes-exercises/src/main/java/org/launchcode/AlicesAdventures.java
new file mode 100644
index 000000000..840fc9309
--- /dev/null
+++ b/datatypes/datatypes-exercises/src/main/java/org/launchcode/AlicesAdventures.java
@@ -0,0 +1,31 @@
+package org.launchcode;
+
+import java.util.Scanner;
+public class AlicesAdventures {
+ public static void main(String[] arg){
+ Scanner input = new Scanner(System.in);
+ String firstLine = "Alice was beginning to get very tired of sitting by her sister on the " +
+ "bank, and of having nothing to do: once or twice she had peeped into the book " +
+ "her sister was reading, but it had no pictures or conversations in it, ‘and " +
+ "what is the use of a book,’ thought Alice ‘without pictures or conversation?’";
+ System.out.println("What term would you like to find: ");
+ String searchTerm = input.next().toLowerCase();
+ String lowerCaseFirstLine = firstLine.toLowerCase();
+
+ System.out.println(lowerCaseFirstLine.contains(searchTerm));
+
+
+ if (lowerCaseFirstLine.contains(searchTerm)){
+ Integer startOfSearchTerm = lowerCaseFirstLine.indexOf(searchTerm);
+ Integer lengthOfSearchTerm = searchTerm.length();
+ System.out.println(startOfSearchTerm);
+ System.out.println(lengthOfSearchTerm);
+ String newFirstLine = firstLine.replace(searchTerm + " ", "");
+// String newFirstLine = lowerCaseFirstLine.substring(0, lowerCaseFirstLine.indexOf(searchTerm)) + lowerCaseFirstLine.substring(lowerCaseFirstLine.indexOf(searchTerm) + searchTerm.length() + 1);
+ System.out.println(newFirstLine);
+ }
+
+
+ input.close();
+ }
+}
diff --git a/datatypes/datatypes-exercises/src/main/java/org/launchcode/HelloWorld.java b/datatypes/datatypes-exercises/src/main/java/org/launchcode/HelloWorld.java
new file mode 100644
index 000000000..89aa523dd
--- /dev/null
+++ b/datatypes/datatypes-exercises/src/main/java/org/launchcode/HelloWorld.java
@@ -0,0 +1,14 @@
+package org.launchcode;
+
+import java.util.Scanner;
+
+public class HelloWorld {
+
+ public static void main(String[] args) {
+ Scanner input = new Scanner(System.in);
+ System.out.println("Hello, what is your name: ");
+ String name = input.nextLine();
+ System.out.println("Hello " + name);
+ input.close();
+ }
+}
diff --git a/datatypes/datatypes-exercises/src/main/java/org/launchcode/InputOutput.java b/datatypes/datatypes-exercises/src/main/java/org/launchcode/InputOutput.java
new file mode 100644
index 000000000..9f4da8a80
--- /dev/null
+++ b/datatypes/datatypes-exercises/src/main/java/org/launchcode/InputOutput.java
@@ -0,0 +1,4 @@
+package org.launchcode;
+
+public class InputOutput {
+}
diff --git a/datatypes/datatypes-exercises/src/main/java/org/launchcode/MilesPerGallon.java b/datatypes/datatypes-exercises/src/main/java/org/launchcode/MilesPerGallon.java
new file mode 100644
index 000000000..b0ae70237
--- /dev/null
+++ b/datatypes/datatypes-exercises/src/main/java/org/launchcode/MilesPerGallon.java
@@ -0,0 +1,17 @@
+package org.launchcode;
+import java.util.Scanner;
+public class MilesPerGallon {
+ public static void main(String[] arg){
+ Scanner input = new Scanner(System.in);
+ System.out.println("How many miles have you driven: ");
+ Double miles = input.nextDouble();
+
+ System.out.println("How many gallons of gas did you use: ");
+ Double gallons = input.nextDouble();
+
+ Double milesPerGallon = miles / gallons;
+
+ System.out.println("Miles per Gallon: " + milesPerGallon);
+ input.close();
+ }
+}
diff --git a/datatypes/datatypes-exercises/src/main/java/org/launchcode/RectangleArea.java b/datatypes/datatypes-exercises/src/main/java/org/launchcode/RectangleArea.java
new file mode 100644
index 000000000..7c5d3fd39
--- /dev/null
+++ b/datatypes/datatypes-exercises/src/main/java/org/launchcode/RectangleArea.java
@@ -0,0 +1,19 @@
+package org.launchcode;
+
+import java.util.Scanner;
+
+public class RectangleArea {
+ public static void main(String[] arg) {
+ Scanner input = new Scanner(System.in);
+ System.out.println("What is the length of the rectangle: ");
+ int length = input.nextInt();
+
+ System.out.println("What is the width of the rectangle: ");
+ int width = input.nextInt();
+
+ int area = length * width;
+
+ System.out.println("Length: " + length + "\nWdith: " + width + "\nArea: " + area );
+ input.close();
+ }
+}
diff --git a/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java b/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
new file mode 100644
index 000000000..1e4baf968
--- /dev/null
+++ b/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
@@ -0,0 +1,17 @@
+package org.launchcode;
+import studios.areaofacircle.Circle;
+
+import java.util.Scanner;
+
+
+public class Area {
+ public static void main(String[] arg){
+ Scanner input = new Scanner(System.in);
+ System.out.println("Enter a radius: ");
+ double radius = input.nextDouble();
+ double area = Circle.getArea(radius);
+
+ System.out.println(radius);
+ System.out.println("The area of a circle of a radius " + radius + "is: " + area);
+ }
+}
diff --git a/datatypes/datatypes-studio/src/main/java/studios/areaofacircle/Circle.java b/datatypes/datatypes-studio/src/main/java/studios/areaofacircle/Circle.java
new file mode 100644
index 000000000..aac4cfe88
--- /dev/null
+++ b/datatypes/datatypes-studio/src/main/java/studios/areaofacircle/Circle.java
@@ -0,0 +1,7 @@
+package studios.areaofacircle;
+
+public class Circle {
+ public static Double getArea(Double radius) {
+ return 3.14 * radius * radius;
+ }
+}
From faa1b45c58474b6f23ba01a5bc92b43f55a11e18 Mon Sep 17 00:00:00 2001
From: Dustin Dev <94726570+dustinFriesenDev@users.noreply.github.com>
Date: Mon, 21 Aug 2023 10:54:11 -0400
Subject: [PATCH 02/15] Finished studio with bonus mission
---
.../src/main/java/org/launchcode/Area.java | 24 +++++++++++++++----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java b/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
index 1e4baf968..fc69ff272 100644
--- a/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
+++ b/datatypes/datatypes-studio/src/main/java/org/launchcode/Area.java
@@ -5,13 +5,27 @@
public class Area {
- public static void main(String[] arg){
+ public static void main(String[] arg) {
+ Double radius;
Scanner input = new Scanner(System.in);
System.out.println("Enter a radius: ");
- double radius = input.nextDouble();
- double area = Circle.getArea(radius);
- System.out.println(radius);
- System.out.println("The area of a circle of a radius " + radius + "is: " + area);
+ try {
+ radius = input.nextDouble();
+ while (radius < 0) {
+ System.out.println("Invalid input: Please enter a positive radius: ");
+ radius = input.nextDouble();
+ }
+
+ Double area = Circle.getArea(radius);
+ System.out.println(radius);
+ System.out.println("The area of a circle of a radius " + radius + " is: " + area);
+
+ } catch (Exception e) {
+ System.out.println("Enter a numbered radius: Please start over");
+ }
+
+
+ input.close();
}
}
From faf1da451e78d35ed529f788e5fabe67a7d1cc43 Mon Sep 17 00:00:00 2001
From: Dustin Dev <94726570+dustinFriesenDev@users.noreply.github.com>
Date: Thu, 24 Aug 2023 20:58:50 -0400
Subject: [PATCH 03/15] Finished studio without bonus and trying to update
repository
---
.../exercises/src/main/java/Student.java | 10 --
.../src/main/java/StudentPractice.java | 5 -
.../src/main/java/org/launchcode/Course.java | 7 ++
.../src/main/java/org/launchcode/Student.java | 41 +++++++
.../java/org/launchcode/StudentPractice.java | 8 ++
.../src/main/java/org/launchcode/Teacher.java | 42 +++++++
.../collections-exercises/.gitignore | 38 ------
.../exercises/collections-exercises/pom.xml | 2 +-
.../src/main/java/org/example/Main.java | 19 ---
.../java/org/launchcode/ArrayPractice.java | 110 ++++++++++++++++++
.../studio/counting-characters/pom.xml | 17 +++
.../org/launchcode/CountingCharacters.java | 40 +++++++
.../org/launchcode/CountingCharacters.class | Bin 0 -> 2850 bytes
13 files changed, 266 insertions(+), 73 deletions(-)
delete mode 100644 classes-part-one/exercises/src/main/java/Student.java
delete mode 100644 classes-part-one/exercises/src/main/java/StudentPractice.java
create mode 100644 classes-part-one/exercises/src/main/java/org/launchcode/Course.java
create mode 100644 classes-part-one/exercises/src/main/java/org/launchcode/Student.java
create mode 100644 classes-part-one/exercises/src/main/java/org/launchcode/StudentPractice.java
create mode 100644 classes-part-one/exercises/src/main/java/org/launchcode/Teacher.java
delete mode 100644 control-flow-and-collections/exercises/collections-exercises/.gitignore
delete mode 100644 control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
create mode 100644 control-flow-and-collections/exercises/collections-exercises/src/main/java/org/launchcode/ArrayPractice.java
create mode 100644 control-flow-and-collections/studio/counting-characters/pom.xml
create mode 100644 control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
create mode 100644 control-flow-and-collections/studio/counting-characters/target/classes/org/launchcode/CountingCharacters.class
diff --git a/classes-part-one/exercises/src/main/java/Student.java b/classes-part-one/exercises/src/main/java/Student.java
deleted file mode 100644
index d06997866..000000000
--- a/classes-part-one/exercises/src/main/java/Student.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Student {
- private String name;
- private int studentId;
- private int numberOfCredits = 0;
- private double gpa = 0.0;
-
- // Drop your getters and setters below for the Student class.
- // To instantiate the Student class, add your code to the main in the file, SchoolPractice.
-
-}
diff --git a/classes-part-one/exercises/src/main/java/StudentPractice.java b/classes-part-one/exercises/src/main/java/StudentPractice.java
deleted file mode 100644
index bb0c0eb7e..000000000
--- a/classes-part-one/exercises/src/main/java/StudentPractice.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class StudentPractice {
- public static void main(String[] args){
- //insantiate your Student class below
- }
-}
diff --git a/classes-part-one/exercises/src/main/java/org/launchcode/Course.java b/classes-part-one/exercises/src/main/java/org/launchcode/Course.java
new file mode 100644
index 000000000..db21b1e4c
--- /dev/null
+++ b/classes-part-one/exercises/src/main/java/org/launchcode/Course.java
@@ -0,0 +1,7 @@
+import java.util.ArrayList;
+
+public class Course {
+ private String topic;
+ private Teacher instructor;
+ private ArrayList enrolledStudents;
+}
diff --git a/classes-part-one/exercises/src/main/java/org/launchcode/Student.java b/classes-part-one/exercises/src/main/java/org/launchcode/Student.java
new file mode 100644
index 000000000..00a609664
--- /dev/null
+++ b/classes-part-one/exercises/src/main/java/org/launchcode/Student.java
@@ -0,0 +1,41 @@
+public class Student {
+ public String name;
+ public int studentId;
+ public int numberOfCredits = 0;
+ public double gpa = 0.0;
+
+ public Student(String name, int studentId, int numberOfCredits, double gpa) {
+ this.name = name;
+ this.studentId = studentId;
+ this.numberOfCredits = numberOfCredits;
+ this.gpa = gpa;
+ }
+
+ // Drop your getters and setters below for the Student class.
+ // To instantiate the Student class, add your code to the main in the file, SchoolPractice.
+ public String getName(){
+ return name;
+ }
+ public int getStudentId() {
+ return studentId;
+ }
+ public int getNumberOfCredits(){
+ return numberOfCredits;
+ }
+ public double getGpa(){
+ return gpa;
+ }
+
+ public void setName(String name){
+ this.name = name;
+ }
+ public void setStudentId(int studentId){
+ this.studentId = studentId;
+ }
+ private void setNumberOfCredits(int numberOfCredits){
+ this.numberOfCredits = numberOfCredits;
+ }
+ public void setGpa(double gpa){
+ this.gpa = gpa;
+ }
+}
diff --git a/classes-part-one/exercises/src/main/java/org/launchcode/StudentPractice.java b/classes-part-one/exercises/src/main/java/org/launchcode/StudentPractice.java
new file mode 100644
index 000000000..4508abc4e
--- /dev/null
+++ b/classes-part-one/exercises/src/main/java/org/launchcode/StudentPractice.java
@@ -0,0 +1,8 @@
+
+
+public class StudentPractice {
+ public static void main(String[] args){
+ Student student = new Student("Dustin", 12345, 1, 4.0);
+ System.out.println(student);
+ }
+}
diff --git a/classes-part-one/exercises/src/main/java/org/launchcode/Teacher.java b/classes-part-one/exercises/src/main/java/org/launchcode/Teacher.java
new file mode 100644
index 000000000..02a68a314
--- /dev/null
+++ b/classes-part-one/exercises/src/main/java/org/launchcode/Teacher.java
@@ -0,0 +1,42 @@
+public class Teacher {
+ private String firstName;
+ private String lastName;
+ private String subject;
+ private int yearsTeaching;
+
+ public Teacher (String firstName, String lastName, String subject, int yearsTeaching){
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.subject = subject;
+ this.yearsTeaching = yearsTeaching;
+ }
+
+ public String getFirstName(){
+ return firstName;
+ }
+ public String getLastName(){
+ return lastName;
+ }
+ public String getSubject(){
+ return subject;
+ }
+ public int getYearsTeaching(){
+ return yearsTeaching;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public void setYearsTeaching(int yearsTeaching) {
+ this.yearsTeaching = yearsTeaching;
+ }
+}
diff --git a/control-flow-and-collections/exercises/collections-exercises/.gitignore b/control-flow-and-collections/exercises/collections-exercises/.gitignore
deleted file mode 100644
index 5ff6309b7..000000000
--- a/control-flow-and-collections/exercises/collections-exercises/.gitignore
+++ /dev/null
@@ -1,38 +0,0 @@
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### IntelliJ IDEA ###
-.idea/modules.xml
-.idea/jarRepositories.xml
-.idea/compiler.xml
-.idea/libraries/
-*.iws
-*.iml
-*.ipr
-
-### Eclipse ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
-
-### Mac OS ###
-.DS_Store
\ No newline at end of file
diff --git a/control-flow-and-collections/exercises/collections-exercises/pom.xml b/control-flow-and-collections/exercises/collections-exercises/pom.xml
index d69c9ebac..eaee8bc3a 100644
--- a/control-flow-and-collections/exercises/collections-exercises/pom.xml
+++ b/control-flow-and-collections/exercises/collections-exercises/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.example
- untitled
+ collections-exercises
1.0-SNAPSHOT
diff --git a/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java b/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
deleted file mode 100644
index 910825b48..000000000
--- a/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/example/Main.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.example;
-
-// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
-// then press Enter. You can now see whitespace characters in your code.
-public class Main {
- public static void main(String[] args) {
- // Press Alt+Enter with your caret at the highlighted text to see how
- // IntelliJ IDEA suggests fixing it.
- System.out.printf("Hello and welcome!");
-
- // Press Shift+F10 or click the green arrow button in the gutter to run the code.
- for (int i = 1; i <= 5; i++) {
-
- // Press Shift+F9 to start debugging your code. We have set one breakpoint
- // for you, but you can always add more by pressing Ctrl+F8.
- System.out.println("i = " + i);
- }
- }
-}
\ No newline at end of file
diff --git a/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/launchcode/ArrayPractice.java b/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/launchcode/ArrayPractice.java
new file mode 100644
index 000000000..f14e1bde9
--- /dev/null
+++ b/control-flow-and-collections/exercises/collections-exercises/src/main/java/org/launchcode/ArrayPractice.java
@@ -0,0 +1,110 @@
+package org.launchcode;
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ArrayPractice {
+ public static void main(String[] args) {
+// Array Practice
+// Steps 1 and 2
+ int[] integerArray = {1, 1, 2, 3, 5, 8};
+ for (int integer : integerArray) {
+ System.out.println(integer);
+ int odd = integer % 2;
+ if (odd == 1){
+ System.out.println(integer);
+ }
+ }
+// Steps 3, 4, 5
+ String str = "I would not, could not, in a box. I would not, could not with a fox. " +
+ "I will not eat them in a house. I will not eat them with a mouse.";
+ String[] strArray = str.split("\\.");
+ System.out.println(Arrays.toString(strArray));
+
+// ArrayList Practice
+// Step 1
+ ArrayList nums = new ArrayList<>();
+ nums.add(1);
+ nums.add(2);
+ nums.add(3);
+ nums.add(4);
+ nums.add(5);
+ nums.add(6);
+ nums.add(7);
+ nums.add(8);
+ nums.add(9);
+ nums.add(10);
+
+ int sum = 0;
+ for (int number : nums){
+ if (number % 2 == 0){
+ sum += number;
+ }
+ }
+ System.out.println(sum);
+// Step 2 and 3
+ ArrayList words = new ArrayList<>();
+ words.add("I");
+ words.add("do");
+ words.add("not");
+ words.add("like");
+ words.add("apple");
+
+ Scanner input = new Scanner(System.in);
+// System.out.println("Enter length of word 1 - 5: ");
+// int userChoice = input.nextInt();
+// for (String word : words){
+// if(word.length() == userChoice){
+// System.out.println(word);
+// }
+// }
+// Step 4
+// System.out.println("Pick a number between 1 and 6");
+// int userInput = input.nextInt();
+// String[] strSplit = str.split(" ");
+//
+// ArrayList strList = new ArrayList<>(Arrays.asList(strSplit));
+// for (String s : strList ){
+// if(s.length() == userInput){
+// System.out.println(s);
+// }
+// }
+
+// HashMap Practice
+// Step 1
+
+ HashMap classRoster = new HashMap<>();
+ String newStudent;
+
+ System.out.println("Enter your students (or ENTER to finish):");
+
+ do {
+ System.out.println("Student: ");
+ newStudent = input.nextLine();
+
+ if (!newStudent.equals("")) {
+ System.out.print("ID: ");
+ Integer newID = input.nextInt();
+ classRoster.put(newID, newStudent);
+
+ input.nextLine();
+ }
+ } while(!newStudent.equals(""));
+
+ input.close();
+
+ System.out.println("\nClass roster:");
+
+ for (Map.Entry student : classRoster.entrySet()) {
+ System.out.println(student.getValue() + "'s ID: " + student.getKey());
+ }
+
+ System.out.println("Number of students in roster: " + classRoster.size());
+
+ input.close();
+ }
+}
+// to get one of the practices to work you have to comment out the other practice to void the input.
+// Not sure why at this time 8/21/2023
\ No newline at end of file
diff --git a/control-flow-and-collections/studio/counting-characters/pom.xml b/control-flow-and-collections/studio/counting-characters/pom.xml
new file mode 100644
index 000000000..792c4d470
--- /dev/null
+++ b/control-flow-and-collections/studio/counting-characters/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ org.example
+ counting-characters
+ 1.0-SNAPSHOT
+
+
+ 17
+ 17
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java b/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
new file mode 100644
index 000000000..8cfc54ea3
--- /dev/null
+++ b/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
@@ -0,0 +1,40 @@
+package org.launchcode;
+
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Scanner;
+
+public class CountingCharacters {
+ public static void main(String[] args) {
+
+ String hiddenFigures = "If the product of two terms is zero then common sense says at least " +
+ "one of the two terms has to be zero to start with. So if you move all the " +
+ "terms over to one side, you can put the quadratics into a form that can " +
+ "be factored allowing that side of the equation to equal zero. " +
+ "Once you’ve done that, it’s pretty straightforward from there.";
+
+ char[] charactersInString = hiddenFigures.toCharArray();
+ HashMap character = new HashMap<>();
+
+ for (int i = 0; i < charactersInString.length; i++){
+ Integer intCounter = 0;
+ char charPlaceholder = charactersInString[i];
+ character.put(charPlaceholder, intCounter);
+ for(char c : charactersInString){
+ if(charPlaceholder == c){
+ character.put(charPlaceholder, character.get(charPlaceholder)+1);
+
+ }
+ }
+ }
+
+
+
+
+ for (Map.Entry c : character.entrySet()) {
+ System.out.println(c.getKey() + ": " + c.getValue());
+ }
+ }
+}
\ No newline at end of file
diff --git a/control-flow-and-collections/studio/counting-characters/target/classes/org/launchcode/CountingCharacters.class b/control-flow-and-collections/studio/counting-characters/target/classes/org/launchcode/CountingCharacters.class
new file mode 100644
index 0000000000000000000000000000000000000000..509ee5396ba0a54097c4af0dbbbd3f59c31983b9
GIT binary patch
literal 2850
zcmbVOS#ujz8a+2!T2eaLv5^zAO$Quf6UUy(1P^1!FhoO$Ce8v54iJXnx^*peEOm?S
zD;u#h6PBMaP(>A$msIfv4-UyxrFiCzzrX`Of}$|zcFT5~xS$wS_4Y02+rO)Ce!6uV
zz#Kj*VGlAEvNm$a3-n)+t8%I-{rc4Tr7OzS0{Ii3@9D<{GGpV51r&r>tS&pcp`3OY
z)H<$q0)DOqj#gnSa=gfSU4{H=DBp2|Rx9wGNcoX+BH4``shy^h5tV!uD-vg0xgjG*
z2hNh}VFXU3WvHDsPd6r=g~0Kaoo>)^TEVJvWV0E&k=P|AG`a>i@@i@#7IdZWv^zSM
zd$l8Lq12vBCw)pvXE_L4WYH%hN2|-y)j_Cg20K{u{CdJQc$>~D!f1~{5y8ASV^=4g
z^S-N$$?x9%n7-AF8wPp8@ia*hlcluoGM-R+^@gVDH5t~NnqsCd;E};*Z5(aU%g|dwy
z9N3hKYg_fTs;f}IT9wU?I=?J1G*%s-->!a7Vzz`~++*QhgK?k0;I@SEgy}LU2gfRD
z-7OBa`|yB`Kfq!8unq!`jirnvEjD{6C5_e-GEfiNcnBkesw+Z`?gF)|;vhzCJd81c
z0t>%rB96PcYA_$MaRd`&DPM=(1p~Z)tOpZkl%(0cn8cKYKic>cjtT7B&UdU(@R$b4
z&M|3B>sEVo0vyMq7N%|d1&;{~Yy)hHuomq8bLurZz)5@2Xw2A{#R*p0kI8p$VyEVF
z)&fT}DNF1wi$C&|38jd?;YkZ8ZB+30o$b_(v}(~zU@B5h((eUR7uaQ*y{2S~4$t9~
zji-(IJkxzfbq%R%;~$1pASq7d0N2R8jk7o>aG)huR3-3TsV{M0`Nrw>b@cyKJ!yG1
z&;>kW;aM9CxVRbTPFI<@wsE}aGnRBq^dQC;Ei4Kg3c@-UTgP`BZctNGm7wEmPSsYk
z(#>pz9D%-h&sXOoV*K7>8eK1tQk4s@v3f>a%UeH<1(z%)4^SA
zvzZ%St)~1_UcD14N)4op_8cV9*o>z=s`?34V9#YbT-@Sp`I}xuv_7;mdENGA0-s1M
z?R57<%KTPs(ko&!5swpkE``wBe7{S7--4Fz3P&a`sfD_Q71m%O=!C91<(bkSxU*3v
z&Gd4jP6mOFxX;^Xm2L#Js4tJ#O6cNs3vZZ_cvE0xdtZ9~YOtcFlH?^*awRrgvr!qQdiUflF<+fVbH`
zV#W~ycGdS)SZT^AQjvxCcI-jsP#_mC9t&3m4&M>@Zt+<7K;VI27v=s*g2y2|$A2s4
zw+A$aJnxtIHN~gkGxx|1h%aLH^Sm22P{a$o+lc^P#O0Xw68=dFmBshSVlQd82CVrb
z>nNW6ANpRnf&J$))7f%%;`TMD%vTtg$xW2A$EWj0%lWTxa5%S)`!7w*Si{!s=|X0@
zST2?e*YN1DRW2T%E|v4;(q}l7$R_u79QqoA>o}Z!g=j|mYEfL@_~vSs_fL+lWBewL
z3e04Ovp4Z)fsb*-y!}<+Ys}5$zQhy5xtn-Oz&uV1+`<`P9p|rad}|`k!bE%${k+@A
zU;qUk{{1N99v<8d4qy}qag2xg8B(6by=e1&mHam`f=_XnSfjYfQ_^JXC1&jmX)ohn
z{7>Rw5wAcp;iKHfOQhwA?ZHKjc0VP~%TVMphge3P&kSy$K?$A{_!3vJ!h-eVb2QN+
z&!@x?DT!u4&4kw`?^W_H!rGvLoQ2Rr$pU+=kCoiOxcN%aEDQ>=*_t@EL6~1^{D9n#
qM&2r7&|IQcjAH0tbG5j;}?g8Nd
literal 0
HcmV?d00001
From 8c0c04512f0532acdc44266bee6046916432d97d Mon Sep 17 00:00:00 2001
From: Dustin Dev <94726570+dustinFriesenDev@users.noreply.github.com>
Date: Thu, 24 Aug 2023 21:08:27 -0400
Subject: [PATCH 04/15] Finished bonus missions but not super bonus mission
---
.../org/launchcode/CountingCharacters.java | 27 ++++++++++++++++--
.../org/launchcode/CountingCharacters.class | Bin 2850 -> 3708 bytes
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java b/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
index 8cfc54ea3..a68efe1f6 100644
--- a/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
+++ b/control-flow-and-collections/studio/counting-characters/src/main/java/org/launchcode/CountingCharacters.java
@@ -30,11 +30,32 @@ public static void main(String[] args) {
}
}
-
-
-
for (Map.Entry c : character.entrySet()) {
System.out.println(c.getKey() + ": " + c.getValue());
}
+
+ HashMap userCharacter = new HashMap<>();
+ Scanner input = new Scanner(System.in);
+ System.out.println("Enter a phrase to count letters: ");
+ String userString = input.nextLine();
+ char[] userChar = userString.toLowerCase().toCharArray();
+
+
+ for (char value : userChar){
+ if (Character.isLetter(value)){
+ Integer counter = 0;
+ userCharacter.put(value, counter);
+ for(char c : userChar){
+ if(value == c){
+ userCharacter.put(value, userCharacter.get(value)+1);
+ }
+ }
+ }
+ }
+ for (Map.Entry c : userCharacter.entrySet()) {
+ System.out.println(c.getKey() + ": " + c.getValue());
+ }
+
+
}
}
\ No newline at end of file
diff --git a/control-flow-and-collections/studio/counting-characters/target/classes/org/launchcode/CountingCharacters.class b/control-flow-and-collections/studio/counting-characters/target/classes/org/launchcode/CountingCharacters.class
index 509ee5396ba0a54097c4af0dbbbd3f59c31983b9..2b50399c101bb26df1cb55b9e6cb583e9e995f8c 100644
GIT binary patch
delta 1341
zcmaJXL~xp
zzoLMDW1=2GrlNB~=7nCsMMoi7)OcYuA@PO_5^gnKc;THPWc4{M!(FHs=ljn0z0c44
zzTZ2$@>aL@)8gd?09l;Bp#2`KwC^(~%w*ZM^T{1K({Ze#iih!(j$!N)Xt5oE*gykg
z7m|-T<7Ib;TeQprTQm$}w+;y-0$siT3P}tpcvhfitK(Y5xEUWGE1D%M?iS*?LfLWS
zdCRpKDP`imn5kngasrBD9dZY3#}Zi4n`jE>O=mPoW7`>}u?9=W^FB8076u9jtztiQ
zH5eGvVPhXP?9zbcQd=O{+n?AaBk%ngT#U*MWB*#3F!N>0`$IbNNNc%7g)y^e<{Avi
z_RAFLYkWU&l1(!ANnR(k#W@Pma}cAG@QmqGS2AOj%jaH{y}`=tyQ|Z
zKND#Er{UYpaVEm<6c5Yz!rP)mXyFrqE8_@pJ-}0vyWlSM%|l#hgdMJa
z7*J8*sy6``#|w?SB1*g=Ik1Qz+5z#Ew?eH|t{^fzkM>OP3I>NSV&^=b&PW&WP{%V>
zJZ?x;?8$_TP!-Qrp=M-5&M1bmkX8d}EvCiPSriQ=rlr#1Sojh~r!f+^gpQ1E1pRZD
zp;vL&PLf)U)`fIiARUQCVr{e7WVFU2sdO|Jj>e)hShWNv%PXiWhazIG{^K!?>y#0!
zB2mLS0pGcXjRMoS*Z*~fz
z56J;
zJ&Bh|(P_UIuaFX^NfW2~kA+uJVHp8&9!KyRpHdMscpXPM8BuWt$8a10mh&qMJx-6S
zxQ;jR7E`!^pYb*sAr|)?D({dYW0F#RcTzdQRGMZdI6Y0dsXKC0#Jx-WHMG@Ph9u*p
z3{A#+G9sL}I@`w6vO5`_f?-yI4RvO)oKf*9HzD2fIjNgiU&m&Im(!^#V{pl#p;AW*
z(f`HJuk*HL%D4Pa#s1r5`?@3X!Zd;pKT!sdR+?_+$*QwQ&}e6r6&DrPW?
Hb1?n}i)9$F
delta 511
zcmZ9HJ5Q5g6vuxL_U+U6r67?6ZDP=YOCT|g%G!m*Nt-wbcqvHbPO+`fB6y+RaernO
zHeoP0NMK-MA~Ep`xRMyZ0ckA%w_OOsb573xcFt41y4evN{og+TQhePB{zlv%uj>9q
z*W7oz9htG@+*mBtx)QL;E6eLRY2LVRu|u=w^8S@;?+q>U+2w4qT$)=*rn5zZcPC$3
zT(x{Mbi3bvXV7)8P{@^wmM`v?e9L
zfX6(kV;M$;$ZU>@&@61<4F`KIp*uq89;D3$@!ORyHt6OjJ?zn2&&nwCuCOtl5^$Yi
z#>wiO9`5r@Sd@0=m|#*#8ziKg5~~eNGoyZiU1p^)#Q4EHIen*%Ef#n#E-yugkcP8R
zk+ne5a5{ro+Kp%<@>WeT=N%__)zC6
Date: Fri, 8 Sep 2023 16:53:01 -0400
Subject: [PATCH 05/15] Finished Studio part 2 and exercises for part one and
two.
---
.../src/main/java/org/launchcode/Main.java | 89 ++++++++++++++++++-
.../main/java/org/launchcode/MenuItem.java | 14 +++
.../src/main/java/org/launchcode/Main.java | 8 --
.../main/java/org/launchcode/Restaurant.java | 32 +++++++
4 files changed, 134 insertions(+), 9 deletions(-)
delete mode 100644 classes-part-one/studio/restaurant-menu/src/main/java/org/launchcode/Main.java
create mode 100644 classes-part-one/studio/restaurant-menu/src/main/java/org/launchcode/Restaurant.java
diff --git a/classes-part-2/studio/src/main/java/org/launchcode/Main.java b/classes-part-2/studio/src/main/java/org/launchcode/Main.java
index a284b3822..5842dcd77 100644
--- a/classes-part-2/studio/src/main/java/org/launchcode/Main.java
+++ b/classes-part-2/studio/src/main/java/org/launchcode/Main.java
@@ -1,8 +1,95 @@
package org.launchcode;
+import java.sql.SQLOutput;
+import java.util.ArrayList;
+import java.util.Date;
+
public class Main {
+ static Date date = new Date();
+ static ArrayList