diff --git a/Day 24-27 (database)/sprint.txt b/Day 24-27 (database)/sprint.txt
deleted file mode 100644
index 6560251..0000000
--- a/Day 24-27 (database)/sprint.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Sprint planning:
- Determine tasks to be completed this week, with quick difficulty estimates. Tasks should be relatively small, specific, completable pieces of work. Plan how it's going to get done. Use the kanban in Gitea to populate it. Spring ends with next Monday's class meeting.
diff --git a/Day 24-27 (database)/CampusVisits.db b/Day 24-37 (database)/CampusVisits.db
similarity index 100%
rename from Day 24-27 (database)/CampusVisits.db
rename to Day 24-37 (database)/CampusVisits.db
diff --git a/Day 24-27 (database)/Database selection.txt b/Day 24-37 (database)/Database selection.txt
similarity index 100%
rename from Day 24-27 (database)/Database selection.txt
rename to Day 24-37 (database)/Database selection.txt
diff --git a/Day 24-27 (database)/Joining_Data_in_SQL_2.pdf b/Day 24-37 (database)/Joining_Data_in_SQL_2.pdf
similarity index 100%
rename from Day 24-27 (database)/Joining_Data_in_SQL_2.pdf
rename to Day 24-37 (database)/Joining_Data_in_SQL_2.pdf
diff --git a/Day 24-27 (database)/indexes.txt b/Day 24-37 (database)/indexes.txt
similarity index 100%
rename from Day 24-27 (database)/indexes.txt
rename to Day 24-37 (database)/indexes.txt
diff --git a/Day 24-27 (database)/notes.txt b/Day 24-37 (database)/notes.txt
similarity index 100%
rename from Day 24-27 (database)/notes.txt
rename to Day 24-37 (database)/notes.txt
diff --git a/Day 24-27 (database)/transactions.txt b/Day 24-37 (database)/transactions.txt
similarity index 100%
rename from Day 24-27 (database)/transactions.txt
rename to Day 24-37 (database)/transactions.txt
diff --git a/Day 38 (class and function design)/CouplingVsCohesion.svg b/Day 38 (class and function design)/CouplingVsCohesion.svg
new file mode 100644
index 0000000..e587b60
--- /dev/null
+++ b/Day 38 (class and function design)/CouplingVsCohesion.svg
@@ -0,0 +1,177 @@
+
+
\ No newline at end of file
diff --git a/Day 38 (class and function design)/Improve the design/CoinInventory.class b/Day 38 (class and function design)/Improve the design/CoinInventory.class
new file mode 100644
index 0000000..71aed65
Binary files /dev/null and b/Day 38 (class and function design)/Improve the design/CoinInventory.class differ
diff --git a/Day 38 (class and function design)/Improve the design/CoinInventory.java b/Day 38 (class and function design)/Improve the design/CoinInventory.java
new file mode 100644
index 0000000..98e1739
--- /dev/null
+++ b/Day 38 (class and function design)/Improve the design/CoinInventory.java
@@ -0,0 +1,26 @@
+
+public class CoinInventory {
+ private int[] coinCounts; //cp (pennies), sp (dimes), ep (half-dollars), gp (dollar bills), pp (five dollar bills)
+ private int weight; //The weight is the sum of all the coins.
+
+ public CoinInventory() {
+ coinCounts = new int[5];
+ }
+
+ public void setCoins(int[] a) {
+ coinCounts = a;
+ }
+
+ public int[] getCoins() {
+ return coinCounts;
+ }
+
+ public void setWeight(int w) {
+ weight = w;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+}
diff --git a/Day 38 (class and function design)/Improve the design/Item.class b/Day 38 (class and function design)/Improve the design/Item.class
new file mode 100644
index 0000000..628a2ff
Binary files /dev/null and b/Day 38 (class and function design)/Improve the design/Item.class differ
diff --git a/Day 38 (class and function design)/Improve the design/Item.java b/Day 38 (class and function design)/Improve the design/Item.java
new file mode 100644
index 0000000..0ff9e1e
--- /dev/null
+++ b/Day 38 (class and function design)/Improve the design/Item.java
@@ -0,0 +1,18 @@
+
+public class Item {
+ private String description;
+ private int weight;
+
+ public Item(String description, int weight) {
+ this.description = description;
+ this.weight = weight;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+}
diff --git a/Day 38 (class and function design)/Improve the design/Player.class b/Day 38 (class and function design)/Improve the design/Player.class
new file mode 100644
index 0000000..543f69c
Binary files /dev/null and b/Day 38 (class and function design)/Improve the design/Player.class differ
diff --git a/Day 38 (class and function design)/Improve the design/Player.java b/Day 38 (class and function design)/Improve the design/Player.java
new file mode 100644
index 0000000..0ea561c
--- /dev/null
+++ b/Day 38 (class and function design)/Improve the design/Player.java
@@ -0,0 +1,77 @@
+//The design among these 3 classes needs improvement, and the code has a couple of bugs, too.
+//Improve the design and fix the bugs.
+//The public interface of Player should remain the same as it is now.
+
+//Hints:
+ //Avoid duplicate data
+ //Methods and instance data should have high cohesion
+ //Coupling should be loose between classes
+
+import java.util.*;
+
+public class Player {
+ private String name;
+ private CoinInventory coinInventory;
+ private ArrayList otherInventory;
+ private int encumbrance;
+
+ public Player(String name) {
+ this.name = name;
+ coinInventory = new CoinInventory();
+ otherInventory = new ArrayList();
+ encumbrance = 0;
+ }
+
+ public void addItem(Item item) {
+ otherInventory.add(item);
+ }
+
+ public void collectMoney(int cp, int sp, int ep, int gp, int pp) {
+ int[] moneys = coinInventory.getCoins();
+ moneys[0] += cp;
+ moneys[1] += sp;
+ moneys[2] += ep;
+ moneys[3] += gp;
+ moneys[4] += pp;
+ coinInventory.setCoins(moneys);
+ }
+
+ public double getRunningSpeed() {
+ double speed = 5 * (1 - getEncumbrance() / 1000.0); //Speed 5 if unencumbered; speed 0 if 1000 units carried or more.
+ if (speed < 0) {
+ return 0;
+ }
+ else {
+ return speed;
+ }
+ }
+
+ public double getMoneyValue() {
+ int[] moneys = coinInventory.getCoins();
+ return .01 * moneys[0] + .1 * moneys[1] + .5 * moneys[2] + 1 * moneys[3] + 5 * moneys[4];
+ }
+
+ public int getEncumbrance() {
+ int[] moneys = coinInventory.getCoins();
+ return moneys[0] + moneys[1] + moneys[2] + moneys[3] + moneys[4] + encumbrance;
+ }
+
+ //Test method.
+ public static void main(String[] args) {
+ Player p = new Player("Whistlestick");
+ Item sword = new Item("Magic sword +2", 20);
+ Item shield = new Item("Normal shield", 40);
+ p.addItem(sword);
+ p.addItem(shield);
+ if (p.getEncumbrance() != 60) throw new RuntimeException("getEncumbrance() should be 60, not " + p.getEncumbrance());
+ p.collectMoney(10,2,0,40,2);
+ if (p.getEncumbrance() != 60+54) throw new RuntimeException("getEncumbrance() should be 114, not " + p.getEncumbrance());
+ if (p.getMoneyValue() != 50.3) throw new RuntimeException("getMoneyValue() should be 50.3, not " + p.getMoneyValue());
+ p.collectMoney(0,0,0,6,0);
+ if (p.getEncumbrance() != 120) throw new RuntimeException("getEncumbrance() should be 120, not " + p.getEncumbrance());
+ if (p.getRunningSpeed() != 4.4) throw new RuntimeException("getRunningSpeed() should be 4.4, not " + p.getRunningSpeed());
+ System.out.println("All tests passed.");
+ }
+
+
+}
\ No newline at end of file
diff --git a/Day 38 (class and function design)/Improve the design/tp06bce7.BAT b/Day 38 (class and function design)/Improve the design/tp06bce7.BAT
new file mode 100644
index 0000000..6a8868c
--- /dev/null
+++ b/Day 38 (class and function design)/Improve the design/tp06bce7.BAT
@@ -0,0 +1,5 @@
+@ECHO OFF
+C:
+CD "\stuff\cs495\notes\Day 38 (class and function design)\Improve the design"
+"C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\java.exe" -cp .;"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.base.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.controls.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.fxml.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.graphics.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.media.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.swing.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx.web.jar";"C:\Program Files\Java\javafx-sdk-17.0.0.1\lib\javafx-swt.jar" --module-path "C:\Program Files\Java\javafx-sdk-17.0.0.1\lib" --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web Player
+PAUSE
diff --git a/Day 38 (class and function design)/Information hiding example/fixed/CS495.class b/Day 38 (class and function design)/Information hiding example/fixed/CS495.class
new file mode 100644
index 0000000..552b3e0
Binary files /dev/null and b/Day 38 (class and function design)/Information hiding example/fixed/CS495.class differ
diff --git a/Day 38 (class and function design)/Information hiding example/fixed/CS495.java b/Day 38 (class and function design)/Information hiding example/fixed/CS495.java
new file mode 100644
index 0000000..350d4f1
--- /dev/null
+++ b/Day 38 (class and function design)/Information hiding example/fixed/CS495.java
@@ -0,0 +1,18 @@
+import java.util.*;
+import java.io.*;
+
+public class CS495 {
+ public static void main(String[] args) throws IOException {
+ ArrayList students = new ArrayList();
+ Scanner in = new Scanner(new File("superheroes.txt"));
+ while(in.hasNextLine()) {
+ String s = in.nextLine();
+ students.add(new Student(s));
+ }
+ in.close();
+
+ for(Student s : students) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/Day 38 (class and function design)/Information hiding example/fixed/Student.class b/Day 38 (class and function design)/Information hiding example/fixed/Student.class
new file mode 100644
index 0000000..f0cecc2
Binary files /dev/null and b/Day 38 (class and function design)/Information hiding example/fixed/Student.class differ
diff --git a/Day 38 (class and function design)/Information hiding example/fixed/Student.java b/Day 38 (class and function design)/Information hiding example/fixed/Student.java
new file mode 100644
index 0000000..dd754ee
--- /dev/null
+++ b/Day 38 (class and function design)/Information hiding example/fixed/Student.java
@@ -0,0 +1,17 @@
+
+public class Student {
+ public static int nextStudentID = 1;
+
+ private int id;
+ private String name;
+
+ public Student(String name) {
+ id = nextStudentID;
+ nextStudentID++;
+ this.name = name;
+ }
+
+ public String toString() {
+ return "Student ID: " +id+ ", name: "+name;
+ }
+}
diff --git a/Day 38 (class and function design)/Information hiding example/fixed/superheroes.txt b/Day 38 (class and function design)/Information hiding example/fixed/superheroes.txt
new file mode 100644
index 0000000..efa55dc
--- /dev/null
+++ b/Day 38 (class and function design)/Information hiding example/fixed/superheroes.txt
@@ -0,0 +1,12 @@
+Clark Kent
+Bruce Wayne
+Hal Jordan
+Oliver Queen
+Steve Rogers
+Barry Allen
+Barbara Gordon
+Tony Stark
+Peter Parker
+Billy Batson
+Bruce Banner
+Diana Prince
\ No newline at end of file
diff --git a/Day 38 (class and function design)/Information hiding example/original/CS495.class b/Day 38 (class and function design)/Information hiding example/original/CS495.class
new file mode 100644
index 0000000..d0fae30
Binary files /dev/null and b/Day 38 (class and function design)/Information hiding example/original/CS495.class differ
diff --git a/Day 38 (class and function design)/Information hiding example/original/CS495.java b/Day 38 (class and function design)/Information hiding example/original/CS495.java
new file mode 100644
index 0000000..63c4f9a
--- /dev/null
+++ b/Day 38 (class and function design)/Information hiding example/original/CS495.java
@@ -0,0 +1,25 @@
+// Two problems with information hiding in this example program.
+
+public class CS495 {
+ public static int nextStudentID = 1;
+
+ public static void main(String[] args) {
+ Student[] students = new Student[12];
+ students[0] = new Student("Clark Kent");
+ students[1] = new Student("Bruce Wayne");
+ students[2] = new Student("Hal Jordan");
+ students[3] = new Student("Oliver Queen");
+ students[4] = new Student("Steve Rogers");
+ students[5] = new Student("Barry Allen");
+ students[6] = new Student("Barbara Gordon");
+ students[7] = new Student("Tony Stark");
+ students[8] = new Student("Peter Parker");
+ students[9] = new Student("Billy Batson");
+ students[10] = new Student("Bruce Banner");
+ students[11] = new Student("Diana Prince");
+
+ for(Student s : students) {
+ System.out.println(s);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Day 38 (class and function design)/Information hiding example/original/Student.class b/Day 38 (class and function design)/Information hiding example/original/Student.class
new file mode 100644
index 0000000..201ce6f
Binary files /dev/null and b/Day 38 (class and function design)/Information hiding example/original/Student.class differ
diff --git a/Day 38 (class and function design)/Information hiding example/original/Student.java b/Day 38 (class and function design)/Information hiding example/original/Student.java
new file mode 100644
index 0000000..7a82e4c
--- /dev/null
+++ b/Day 38 (class and function design)/Information hiding example/original/Student.java
@@ -0,0 +1,15 @@
+
+public class Student {
+ private int id;
+ private String name;
+
+ public Student(String name) {
+ id = CS495.nextStudentID;
+ CS495.nextStudentID++;
+ this.name = name;
+ }
+
+ public String toString() {
+ return "Student ID: " +id+ ", name: "+name;
+ }
+}
diff --git a/Day 38 (class and function design)/notes.txt b/Day 38 (class and function design)/notes.txt
new file mode 100644
index 0000000..c0e491f
--- /dev/null
+++ b/Day 38 (class and function design)/notes.txt
@@ -0,0 +1,25 @@
+Most common reasons for project failure: Poor requirements/planning/management
+
+Most common *technical* reason for project failure: unmanaged complexity
+
+Abstraction: from the outside, we view an object or function as a coherent idea on a high level of detail
+
+Information hiding / encapsulation: from the outside, internal implementation details are not viewable
+
+Loose coupling:
+ * Size (prefer fewer methods and parameters)
+ * Visibility (e.g. avoid sneaking info between objects through a global variable)
+ * Flexibility (objects and functions can be rearanged with relative ease)
+ Example: Passing primitives is looser coupling than passing complex objects
+ Avoid: some object/function requires knowledge of *internal* workings of another object/function.
+
+High cohesion: Methods and data in a class are highly related and belong together
+
+All of this (abstraction, information hiding, loose coupling, high cohesion) mainly comes down to two motivations:
+ Limit the amount of complexity we deal with at a time
+ Limit the effects when a change is made to the code
+This reduces the cognitive load required to understand any given part of the system at a time.
+
+
+
+[The CouplingVsCohesion.svg image is public domain, obtained from https://upload.wikimedia.org/wikipedia/commons/0/09/CouplingVsCohesion.svg]