diff --git a/ActivityLog/ActivityLog.java b/ActivityLog/ActivityLog.java
index b2fc243..f649845 100644
--- a/ActivityLog/ActivityLog.java
+++ b/ActivityLog/ActivityLog.java
@@ -1,49 +1,49 @@
-public class ActivityLog {
- private int actMins;
- private int longest;
- private int longestHigh;
-
-
- public void log(int minutes, boolean high) {
- if(high) {
- actMins += 2 * minutes;
- if(minutes > longestHigh) {
- longestHigh = minutes;
- }
- } else {
- actMins += minutes;
- }
-
- longest = Math.max(longest, minutes);
- }
-
- public int longest(boolean highOnly) {
- return highOnly ? longestHigh : longest;
- }
-
- public int activeMinutes() {
- return actMins;
- }
-
- public static void main(String[] args) {
- ActivityLog a = new ActivityLog();
- System.out.println(a.activeMinutes());
- System.out.println(a.longest(false));
- System.out.println(a.longest(true));
- System.out.println();
-
- a.log(45, false);
- a.log(30, true);
- a.log(30, true);
- System.out.println(a.activeMinutes());
- System.out.println(a.longest(false));
- System.out.println(a.longest(true));
- System.out.println();
-
- a.log(50, true);
- a.log(30, false);
- System.out.println(a.activeMinutes());
- System.out.println(a.longest(false));
- System.out.println(a.longest(true));
- }
+public class ActivityLog {
+ private int actMins;
+ private int longest;
+ private int longestHigh;
+
+
+ public void log(int minutes, boolean high) {
+ if(high) {
+ actMins += 2 * minutes;
+ if(minutes > longestHigh) {
+ longestHigh = minutes;
+ }
+ } else {
+ actMins += minutes;
+ }
+
+ longest = Math.max(longest, minutes);
+ }
+
+ public int longest(boolean highOnly) {
+ return highOnly ? longestHigh : longest;
+ }
+
+ public int activeMinutes() {
+ return actMins;
+ }
+
+ public static void main(String[] args) {
+ ActivityLog a = new ActivityLog();
+ System.out.println(a.activeMinutes());
+ System.out.println(a.longest(false));
+ System.out.println(a.longest(true));
+ System.out.println();
+
+ a.log(45, false);
+ a.log(30, true);
+ a.log(30, true);
+ System.out.println(a.activeMinutes());
+ System.out.println(a.longest(false));
+ System.out.println(a.longest(true));
+ System.out.println();
+
+ a.log(50, true);
+ a.log(30, false);
+ System.out.println(a.activeMinutes());
+ System.out.println(a.longest(false));
+ System.out.println(a.longest(true));
+ }
}
\ No newline at end of file
diff --git a/Address Book/Address.java b/Address Book/Address.java
new file mode 100644
index 0000000..b875eee
--- /dev/null
+++ b/Address Book/Address.java
@@ -0,0 +1,3 @@
+public class Address {
+
+}
diff --git a/Address Book/AddressBook.java b/Address Book/AddressBook.java
new file mode 100644
index 0000000..7df6c0c
--- /dev/null
+++ b/Address Book/AddressBook.java
@@ -0,0 +1,30 @@
+import java.util.*;
+
+public class AddressBook {
+ private List
addresses;
+
+ public AddressBook() {
+ addresses = new ArrayList();
+ }
+
+ public List onStreet(String st) {
+ ArrayList result = new ArrayList();
+
+ for(Address a : addresses) {
+ if(a.getStreet())
+ }
+ }
+
+ public int newBusiness(String nm, String st, int no) {
+ for(int i = 0; i < addresses.size(); i++) {
+ Address a = addresses.get(i);
+ if(a.getStreet().equals(st) && a.getNumber() == no) {
+ addresses.set(i, new Address(nm, st, no));
+ return i;
+ }
+ }
+ addresses.add(new Address(nm, st, no));
+
+ return addresses.size() - 1;
+ }
+}
diff --git a/Fundraiser/Fundraiser.java b/Fundraiser/Fundraiser.java
index 70fbf6c..8650674 100644
--- a/Fundraiser/Fundraiser.java
+++ b/Fundraiser/Fundraiser.java
@@ -1,22 +1,22 @@
-public class Fundraiser {
- private double target;
- private double total;
- private double count = 0;
-
- public Fundraiser(double amount) {
- total = amount;
- }
-
- public double averageDonation() {
- return (count == 0) ? 0.0 : total / count;
- }
-
- public void addDonation(double amount) {
- total += amount;
- count++;
- }
-
- public double distanceToTarget() {
- return (total >= target) ? 0.0 : target - total;
- }
-}
+public class Fundraiser {
+ private double target;
+ private double total;
+ private double count = 0;
+
+ public Fundraiser(double amount) {
+ total = amount;
+ }
+
+ public double averageDonation() {
+ return (count == 0) ? 0.0 : total / count;
+ }
+
+ public void addDonation(double amount) {
+ total += amount;
+ count++;
+ }
+
+ public double distanceToTarget() {
+ return (total >= target) ? 0.0 : target - total;
+ }
+}
diff --git a/Guessing Game/GuessingGame.java b/Guessing Game/GuessingGame.java
index 65c6f0d..0e63b83 100644
--- a/Guessing Game/GuessingGame.java
+++ b/Guessing Game/GuessingGame.java
@@ -1,49 +1,49 @@
-public class GuessingGame {
- private int target;
- private int count;
- private boolean gameWon;
-
- public GuessingGame(int max) {
- target = (int) (max * Math.random()) + 1;
- count = 0;
- gameWon = false;
- }
-
- public String guessAnswer(int guess) {
- if(gameWon) {
- return "Game already over";
- }
- count++;
-
- if(guess > target) {
- return "Too high";
- }
-
- if(guess < target) {
- return "Too low";
- }
-
- gameWon = true;
-
- return "Correct";
- }
-
- public int numGuesses() {
- return count;
- }
-
- public static void main(String[] args) {
- GuessingGame g = new GuessingGame(24);
- System.out.println(g.numGuesses());
- System.out.println(g.guessAnswer(55));
- System.out.println(g.numGuesses());
- System.out.println(g.guessAnswer(12));
- System.out.println(g.guessAnswer(30));
- System.out.println(g.numGuesses());
- System.out.println(g.guessAnswer(24));
- System.out.println(g.numGuesses());
- System.out.println(g.guessAnswer(26));
- System.out.println(g.guessAnswer(24));
- System.out.println(g.numGuesses());
- }
+public class GuessingGame {
+ private int target;
+ private int count;
+ private boolean gameWon;
+
+ public GuessingGame(int max) {
+ target = (int) (max * Math.random()) + 1;
+ count = 0;
+ gameWon = false;
+ }
+
+ public String guessAnswer(int guess) {
+ if(gameWon) {
+ return "Game already over";
+ }
+ count++;
+
+ if(guess > target) {
+ return "Too high";
+ }
+
+ if(guess < target) {
+ return "Too low";
+ }
+
+ gameWon = true;
+
+ return "Correct";
+ }
+
+ public int numGuesses() {
+ return count;
+ }
+
+ public static void main(String[] args) {
+ GuessingGame g = new GuessingGame(24);
+ System.out.println(g.numGuesses());
+ System.out.println(g.guessAnswer(55));
+ System.out.println(g.numGuesses());
+ System.out.println(g.guessAnswer(12));
+ System.out.println(g.guessAnswer(30));
+ System.out.println(g.numGuesses());
+ System.out.println(g.guessAnswer(24));
+ System.out.println(g.numGuesses());
+ System.out.println(g.guessAnswer(26));
+ System.out.println(g.guessAnswer(24));
+ System.out.println(g.numGuesses());
+ }
}
\ No newline at end of file
diff --git a/Hotel Room/Part A/OccupancyInfo.java b/Hotel Room/Part A/OccupancyInfo.java
new file mode 100644
index 0000000..745ac25
--- /dev/null
+++ b/Hotel Room/Part A/OccupancyInfo.java
@@ -0,0 +1,43 @@
+import java.util.ArrayList;
+public class OccupancyInfo
+{
+ private ArrayList rooms;
+ // no two Room objects in rooms have the same room number
+
+
+ /** Attempts to check-in a new guest into a given room number. If a room exists in
+ * the database with the room number requested, and the room is unoccupied, a guest
+ * with the name given is checked-in to that room: the room is marked as occupied,
+ * and the guestName variable in the Room object is set to the name given.
+ * @param name the name of the guest attempting to check-in
+ * @param number the room number into which the guest is to be checked-in
+ * @return -1 if no room with the requested number exists;
+ * 0 if the room requested is occupied;
+ * 1 if the check-in is successful
+ */
+ public int checkIn(String name, int number)
+ {
+ /* Implement your answer to part (a) here */
+
+ for(Room room : rooms) {
+ if(room.getNumber() == number) {
+ return room.checkInNewGuest(name) ? 1 : 0;
+ }
+ }
+
+ return -1;
+ }
+
+
+ /* Methods for subsequent parts of this question are not shown */
+
+ /* CLASS MEMBERS FOR TESTING */
+ /* DO NOT MODIFY ANY OF THE CONSTRUCTORS OR METHODS BELOW*/
+
+ public OccupancyInfo(ArrayList r)
+ { rooms = r; }
+
+ public ArrayList getRooms()
+ { return rooms; }
+
+}
\ No newline at end of file
diff --git a/Hotel Room/Part A/Room.java b/Hotel Room/Part A/Room.java
new file mode 100644
index 0000000..79792cc
--- /dev/null
+++ b/Hotel Room/Part A/Room.java
@@ -0,0 +1,48 @@
+/* COMPLETE WORKING CLASS PROVIDED */
+/* DO NOT MODIFY THE IMPLEMENTATION OF THIS CLASS*/
+
+public class Room
+{
+ private int roomNumber;
+ private boolean occupied;
+ private String bookingName;
+
+
+ /** Attempts to check a new guest into the room. If the room is not occupied (the
+ * variable occupied is false), changes bookingName to name and sets
+ * occupied to true.
+ * Otherwise does not change the values of the member variables.
+ * @param name the name of the guest checking in as a String
+ * @return true if the check-in was successful and bookingName was changed
+ * false otherwise
+ */
+ public boolean checkInNewGuest(String name)
+ {
+ if(occupied) return false;
+ bookingName = name;
+ occupied = true;
+ return true;
+ }
+
+
+ /** @return the room number
+ */
+ public int getNumber()
+ { return roomNumber; }
+
+ /** @return true if the room is occupied; false otherwise.
+ */
+ public boolean isOccupied()
+ { return occupied; }
+
+ public Room (int rn, boolean o, String bn){
+ roomNumber = rn;
+ occupied = o;
+ bookingName = bn;
+ }
+
+ public String toString(){
+ return roomNumber+"; "+occupied+"; "+bookingName;
+ }
+
+}
diff --git a/Hotel Room/Part B/OccupancyInfo.java b/Hotel Room/Part B/OccupancyInfo.java
new file mode 100644
index 0000000..9c8dfc5
--- /dev/null
+++ b/Hotel Room/Part B/OccupancyInfo.java
@@ -0,0 +1,35 @@
+import java.util.ArrayList;
+public class OccupancyInfo
+{
+ private ArrayList rooms;
+ // no two Room objects in rooms have the same room number
+
+ /** Returns an ArrayList containing the number of every room which is not occupied
+ * in the order in which these appear in the ArrayList rooms.
+ */
+ public ArrayList availableRoomNumbers()
+ {
+ /* Implement your answer to part (b) here */
+ ArrayList result = new ArrayList();
+
+ for(Room room : rooms) {
+ if(!room.isOccupied()) {
+ result.add(room.getNumber());
+ }
+ }
+
+ return result;
+ }
+
+ /* Methods for previous parts of this question are not shown */
+
+ /* CLASS MEMBERS FOR TESTING */
+ /* DO NOT MODIFY ANY OF THE CONSTRUCTORS OR METHODS BELOW*/
+
+ public OccupancyInfo(ArrayList r)
+ { rooms = r; }
+
+ public ArrayList getRooms()
+ { return rooms; }
+
+}
\ No newline at end of file
diff --git a/Hotel Room/Part B/Room.java b/Hotel Room/Part B/Room.java
new file mode 100644
index 0000000..4a095ec
--- /dev/null
+++ b/Hotel Room/Part B/Room.java
@@ -0,0 +1,48 @@
+/* COMPLETE WORKING CLASS PROVIDED */
+/* DO NOT MODIFY THE IMPLEMENTATION OF THIS CLASS*/
+
+public class Room
+{
+ private int roomNumber;
+ private boolean occupied;
+ private String bookingName;
+
+
+ /** Attempts to check a new guest into the room. If the room is not occupied (the
+ * variable occupied is false), changes bookingName to name and sets
+ * occupied to true.
+ * Otherwise does not change the values of the member variables.
+ * @param name the name of the guest checking in as a String
+ * @return true if the check-in was successful and bookingName was changed
+ * false otherwise
+ */
+ public boolean checkInNewGuest(String name)
+ {
+ if(occupied) return false;
+ bookingName = name;
+ occupied = true;
+ return true;
+ }
+
+
+ /** @return the room number
+ */
+ public int getNumber()
+ { return roomNumber; }
+
+ /** @return true if the room is occupied; false otherwise.
+ */
+ public boolean isOccupied()
+ { return occupied; }
+
+ public Room (int rn, boolean o, String bn){
+ roomNumber = rn;
+ occupied = o;
+ bookingName = bn;
+ }
+
+ public String toString(){
+ return roomNumber+"; "+occupied+"; "+bookingName;
+ }
+
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 581fb2a..124e774 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# project-stem-keys
-Did da work for ya
+# project-stem-keys
+Did da work for ya
diff --git a/Triangle Number Tracker/TriangleNumberTracker.java b/Triangle Number Tracker/TriangleNumberTracker.java
index 55beaef..dea5826 100644
--- a/Triangle Number Tracker/TriangleNumberTracker.java
+++ b/Triangle Number Tracker/TriangleNumberTracker.java
@@ -1,24 +1,24 @@
-public class TriangleNumberTracker {
- private int term = 1;
- private int number = 1;
-
- public TriangleNumberTracker(int startTerm) {
- for (int i = 2; 1 <= startTerm; i++) {
- nextTriangle();
- }
- }
-
- public int currentTriangle() {
- return number;
- }
-
- public void nextTriangle() {
- term++;
- number += term;
- }
-
- public void prevTriangle() {
- term--;
- number -= term;
- }
-}
+public class TriangleNumberTracker {
+ private int term = 1;
+ private int number = 1;
+
+ public TriangleNumberTracker(int startTerm) {
+ for (int i = 2; 1 <= startTerm; i++) {
+ nextTriangle();
+ }
+ }
+
+ public int currentTriangle() {
+ return number;
+ }
+
+ public void nextTriangle() {
+ term++;
+ number += term;
+ }
+
+ public void prevTriangle() {
+ term--;
+ number -= term;
+ }
+}
diff --git a/Word Sandwich/wordSandwich.java b/Word Sandwich/wordSandwich.java
index f0a1323..c6ac4fe 100644
--- a/Word Sandwich/wordSandwich.java
+++ b/Word Sandwich/wordSandwich.java
@@ -1,27 +1,27 @@
-public class wordSandwich {
- private String[] wordSandwiches;
-
- public wordSandwich(String str1, String str2) {
- makeAllSandwiches(str1, str2);
- }
-
- private void makeAllSandwiches(String str1, String str2) {
- wordSandwiches = new String(str1.length() - 1);
- for(int i = 0; i < wordSandwiches.length; i++) {
- wordSandwiches[i] = makeSandwich(str1, str2, i + 1);
- }
- }
-
- private String makeSandwich(String str1, String str2, int n) {
- return str1.substring(0, n) + str2 + str1.substring(n);
- }
-
- public String[] getFillings(int start, int end) {
- String[] result = new String(wordSandwiches.length);
- for(int i = 0; i < wordSandwiches.length; i++) {
- result[i] = wordSandwiches[i].substring(start, end);
- }
-
- return result;
- }
+public class wordSandwich {
+ private String[] wordSandwiches;
+
+ public wordSandwich(String str1, String str2) {
+ makeAllSandwiches(str1, str2);
+ }
+
+ private void makeAllSandwiches(String str1, String str2) {
+ wordSandwiches = new String(str1.length() - 1);
+ for(int i = 0; i < wordSandwiches.length; i++) {
+ wordSandwiches[i] = makeSandwich(str1, str2, i + 1);
+ }
+ }
+
+ private String makeSandwich(String str1, String str2, int n) {
+ return str1.substring(0, n) + str2 + str1.substring(n);
+ }
+
+ public String[] getFillings(int start, int end) {
+ String[] result = new String(wordSandwiches.length);
+ for(int i = 0; i < wordSandwiches.length; i++) {
+ result[i] = wordSandwiches[i].substring(start, end);
+ }
+
+ return result;
+ }
}
\ No newline at end of file