From 20dca5958418317d09eebe568e58335ad110ee02 Mon Sep 17 00:00:00 2001 From: fredh Date: Mon, 11 Apr 2022 18:11:59 -0500 Subject: [PATCH 01/25] Group 1 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12557a8a6..d63ce9a6d 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,6 @@ To update this Project's SDK to use Java11 on your computer: Occasionally, the LaunchCode team will make changes to this repository that will affect your coursework. When you start your prep-work for each lesson of the course, be sure to fetch to stay up to date with the -latest changes. \ No newline at end of file +latest changes. + +Group 1 \ No newline at end of file From 435eec5addc481af190e7d1678c9044f06cc4f61 Mon Sep 17 00:00:00 2001 From: fredh Date: Mon, 11 Apr 2022 18:12:28 -0500 Subject: [PATCH 02/25] Group 2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d63ce9a6d..4b2644ae8 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,4 @@ that will affect your coursework. When you start your prep-work for each lesson of the course, be sure to fetch to stay up to date with the latest changes. -Group 1 \ No newline at end of file +Group 2 \ No newline at end of file From 9bee737f32786e0e27a5d41eb786deb4994d5b39 Mon Sep 17 00:00:00 2001 From: fredh Date: Mon, 11 Apr 2022 18:13:11 -0500 Subject: [PATCH 03/25] Group 3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b2644ae8..032ccf05e 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,4 @@ that will affect your coursework. When you start your prep-work for each lesson of the course, be sure to fetch to stay up to date with the latest changes. -Group 2 \ No newline at end of file +Group 3 \ No newline at end of file From bd8e5ba62fe21a2663159063b9322f5541762bae Mon Sep 17 00:00:00 2001 From: mhernando Date: Mon, 11 Apr 2022 20:27:09 -0500 Subject: [PATCH 04/25] studio 3 --- .../java/studios/areaofacircle/Area.java | 18 ++++++++++++++++++ .../java/studios/areaofacircle/Circle.java | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 src/org/launchcode/java/studios/areaofacircle/Area.java create mode 100644 src/org/launchcode/java/studios/areaofacircle/Circle.java diff --git a/src/org/launchcode/java/studios/areaofacircle/Area.java b/src/org/launchcode/java/studios/areaofacircle/Area.java new file mode 100644 index 000000000..646234fcf --- /dev/null +++ b/src/org/launchcode/java/studios/areaofacircle/Area.java @@ -0,0 +1,18 @@ +package org.launchcode.java.studios.areaofacircle; + + +import java.util.Scanner; + +public class Area { + public static void main(String[] args) { + Scanner input; + + input = new Scanner(System.in); + + System.out.println("Enter a radius"); + Double radius = input.nextDouble(); + + System.out.println(Circle.getArea(radius)); + } +} + diff --git a/src/org/launchcode/java/studios/areaofacircle/Circle.java b/src/org/launchcode/java/studios/areaofacircle/Circle.java new file mode 100644 index 000000000..850381634 --- /dev/null +++ b/src/org/launchcode/java/studios/areaofacircle/Circle.java @@ -0,0 +1,7 @@ +package org.launchcode.java.studios.areaofacircle; + +public class Circle { + public static Double getArea (Double radius){ + return 3.14 * radius * radius; + } +} From f2a1c97e4e859be97c3a0c806794ace4e4848619 Mon Sep 17 00:00:00 2001 From: mhernando Date: Mon, 11 Apr 2022 20:32:03 -0500 Subject: [PATCH 05/25] studio 3 --- src/org/launchcode/java/studios/areaofacircle/Area.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/launchcode/java/studios/areaofacircle/Area.java b/src/org/launchcode/java/studios/areaofacircle/Area.java index 646234fcf..3e3556b2f 100644 --- a/src/org/launchcode/java/studios/areaofacircle/Area.java +++ b/src/org/launchcode/java/studios/areaofacircle/Area.java @@ -9,7 +9,7 @@ public static void main(String[] args) { input = new Scanner(System.in); - System.out.println("Enter a radius"); + System.out.println("Enter a radius "); Double radius = input.nextDouble(); System.out.println(Circle.getArea(radius)); From 6573b2ac5d130bdb60f3d16719c9f0f8ee65a0bd Mon Sep 17 00:00:00 2001 From: candide Mboungou-Kimpolo Date: Fri, 15 Apr 2022 02:22:22 +0200 Subject: [PATCH 06/25] First step --- src/studio3/CountingCharacters.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/studio3/CountingCharacters.java diff --git a/src/studio3/CountingCharacters.java b/src/studio3/CountingCharacters.java new file mode 100644 index 000000000..28d2ad688 --- /dev/null +++ b/src/studio3/CountingCharacters.java @@ -0,0 +1,25 @@ +package studio3; + + +import java.util.HashMap; + +public class CountingCharacters { + + public static void main(String[] args) { + + String quote = "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 = quote.toCharArray(); + + HashMap count = new HashMap<>(); + + for(char i:charactersInString) { + + if(count.containsKey(i)); + + } + +} +} From f6081df0162db1380a5d3d46b88647894736e374 Mon Sep 17 00:00:00 2001 From: mhernando Date: Thu, 14 Apr 2022 19:49:12 -0500 Subject: [PATCH 07/25] studio 3 - Matt --- src/studio3/CountingCharacters.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/studio3/CountingCharacters.java b/src/studio3/CountingCharacters.java index 28d2ad688..4c501a288 100644 --- a/src/studio3/CountingCharacters.java +++ b/src/studio3/CountingCharacters.java @@ -2,6 +2,7 @@ import java.util.HashMap; +import java.util.Map; public class CountingCharacters { @@ -17,9 +18,16 @@ public static void main(String[] args) { for(char i:charactersInString) { - if(count.containsKey(i)); - + if (count.containsKey(i)) { + count.put(i, count.get(i) + 1); + } else { + count.put(i, 1); + } + } + for (Map.Entry entry : count.entrySet()){ + System.out.println(entry.getKey() + " " + entry.getValue()); + } +// main(quote); } } -} From 626ed4b40146b8e607c484863e0d53d32b6c535a Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 14 Apr 2022 20:02:27 -0500 Subject: [PATCH 08/25] -bonus mission 1 & 2 --- src/studio3/CountingCharacters.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/studio3/CountingCharacters.java b/src/studio3/CountingCharacters.java index 4c501a288..9b2bb4360 100644 --- a/src/studio3/CountingCharacters.java +++ b/src/studio3/CountingCharacters.java @@ -2,15 +2,23 @@ import java.util.HashMap; +import java.util.Locale; import java.util.Map; +import java.util.Scanner; public class CountingCharacters { public static void main(String[] args) { - String quote = "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."; + Scanner input = new Scanner(System.in); + System.out.println("Enter a string of characters: "); + + String quote = input.nextLine().toLowerCase(); + input.close(); + + // String quote = "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 = quote.toCharArray(); From f80bdcbbc56d1a4472c78625a6753a354c77b4cb Mon Sep 17 00:00:00 2001 From: Sravanthi Date: Thu, 14 Apr 2022 20:05:14 -0500 Subject: [PATCH 09/25] Final code --- src/studio2/CountingCharacters.java | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/studio2/CountingCharacters.java diff --git a/src/studio2/CountingCharacters.java b/src/studio2/CountingCharacters.java new file mode 100644 index 000000000..79d2b72c0 --- /dev/null +++ b/src/studio2/CountingCharacters.java @@ -0,0 +1,35 @@ +package studio2; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Scanner; + +public class CountingCharacters { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.println("Enter a string of Characters : "); + String quote = input.nextLine().toLowerCase(Locale.ROOT) ; + + input.close(); + +// String quote = "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 = quote.toCharArray(); + HashMap count = new HashMap<>(); + for (char i : charactersInString) { + + if (count.containsKey(i)) { + count.put(i, count.get(i) + 1); + + }else{ + count.put(i,1); + } + + } + for(Map.Entry entry : count.entrySet()){ + System.out.println(entry.getKey() + " : " + entry.getValue()); + } + } +} From 55bb351ca433e568519f8367eb10a1b727c70242 Mon Sep 17 00:00:00 2001 From: Sravanthi Date: Thu, 14 Apr 2022 20:15:00 -0500 Subject: [PATCH 10/25] Final code --- src/studio2/CountingCharacters.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/studio2/CountingCharacters.java b/src/studio2/CountingCharacters.java index 79d2b72c0..667523f03 100644 --- a/src/studio2/CountingCharacters.java +++ b/src/studio2/CountingCharacters.java @@ -9,7 +9,7 @@ public class CountingCharacters { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a string of Characters : "); - String quote = input.nextLine().toLowerCase(Locale.ROOT) ; + String quote = input.nextLine().toLowerCase(Locale.ROOT); input.close(); @@ -23,12 +23,12 @@ public static void main(String[] args) { if (count.containsKey(i)) { count.put(i, count.get(i) + 1); - }else{ - count.put(i,1); + } else { + count.put(i, 1); } } - for(Map.Entry entry : count.entrySet()){ + for (Map.Entry entry : count.entrySet()) { System.out.println(entry.getKey() + " : " + entry.getValue()); } } From f6b5dd7ed6e9d72fad75d69fabcb535bd8295899 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 18 Apr 2022 19:18:53 -0500 Subject: [PATCH 11/25] created menu class & menu item class --- src/Menu.java | 10 ++++++++++ src/MenuItem.java | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/Menu.java create mode 100644 src/MenuItem.java diff --git a/src/Menu.java b/src/Menu.java new file mode 100644 index 000000000..48898af2e --- /dev/null +++ b/src/Menu.java @@ -0,0 +1,10 @@ +import java.util.ArrayList; + +public class Menu { + + public static void main (String[] args){ + ArrayList restuarantMenu = new ArrayList<>(); + + } + +} diff --git a/src/MenuItem.java b/src/MenuItem.java new file mode 100644 index 000000000..fbb84f8ac --- /dev/null +++ b/src/MenuItem.java @@ -0,0 +1,10 @@ +public class MenuItem { + + public static void main(String[] args){ + String name; + String price; + String descripton; + String category; + boolean ifNew; + } +} From 8f2e4133bbe0f38b83f1ec6f69950a79762bf515 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 18 Apr 2022 19:27:28 -0500 Subject: [PATCH 12/25] put menu and menu items in studio4 --- src/{ => Studio4}/Menu.java | 2 ++ src/{ => Studio4}/MenuItem.java | 2 ++ 2 files changed, 4 insertions(+) rename src/{ => Studio4}/Menu.java (90%) rename src/{ => Studio4}/MenuItem.java (91%) diff --git a/src/Menu.java b/src/Studio4/Menu.java similarity index 90% rename from src/Menu.java rename to src/Studio4/Menu.java index 48898af2e..72b2c7294 100644 --- a/src/Menu.java +++ b/src/Studio4/Menu.java @@ -1,3 +1,5 @@ +package Studio4; + import java.util.ArrayList; public class Menu { diff --git a/src/MenuItem.java b/src/Studio4/MenuItem.java similarity index 91% rename from src/MenuItem.java rename to src/Studio4/MenuItem.java index fbb84f8ac..f44723299 100644 --- a/src/MenuItem.java +++ b/src/Studio4/MenuItem.java @@ -1,3 +1,5 @@ +package Studio4; + public class MenuItem { public static void main(String[] args){ From 23e802978d41cf0e338ea1bdca6a9f6e5e0977c7 Mon Sep 17 00:00:00 2001 From: justjohere <99933020+justjohere@users.noreply.github.com> Date: Mon, 18 Apr 2022 19:44:55 -0500 Subject: [PATCH 13/25] Part 2 of studio 4 --- src/Studio4/MenuItem.java | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Studio4/MenuItem.java b/src/Studio4/MenuItem.java index f44723299..1019bb4fd 100644 --- a/src/Studio4/MenuItem.java +++ b/src/Studio4/MenuItem.java @@ -2,11 +2,21 @@ public class MenuItem { - public static void main(String[] args){ - String name; - String price; - String descripton; - String category; - boolean ifNew; - } + private String name; + private String price; + private String description; + private String category; + private boolean ifNew; + + public MenuItem(String name, String price, String description, String category,boolean ifNew){ + this.name= name; + this.price= price; + this.description= description; + this.category= category; + this.ifNew= ifNew; + + } + + + } From 3395cb644e4585691c250688d493d9b98caf62f5 Mon Sep 17 00:00:00 2001 From: jopamo Date: Thu, 21 Apr 2022 12:45:48 -0500 Subject: [PATCH 14/25] MenuItem: add the getters and setters some need to be removed? (wip) --- src/Studio4/MenuItem.java | 53 ++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/src/Studio4/MenuItem.java b/src/Studio4/MenuItem.java index 1019bb4fd..1c9a9003d 100644 --- a/src/Studio4/MenuItem.java +++ b/src/Studio4/MenuItem.java @@ -1,22 +1,51 @@ package Studio4; public class MenuItem { + private String name; + private String price; + private String description; + private String category; + private boolean ifNew; - private String name; - private String price; - private String description; - private String category; - private boolean ifNew; + public MenuItem(String name, String price, String description, String category, boolean ifNew) { + this.name= name; + this.price= price; + this.description= description; + this.category= category; + this.ifNew= ifNew; + } - public MenuItem(String name, String price, String description, String category,boolean ifNew){ - this.name= name; - this.price= price; - this.description= description; - this.category= category; - this.ifNew= ifNew; + // getters + public double getName() { + return this.name; + } - } + public double getPrice() { + return this.price; + } + public String getDescription() { + return this.description; + } + public String getCategory() { + return this.category; + } + public boolean ifNew() { + return ifNew; + } + + // setters + public void setPrice(double price) { + this.price = price; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setifNew(boolean ifNew) { + this.ifNew = ifNew; + } } From 4d4bf6c0e686b05ded6aa02d7f2e6409a7ffc696 Mon Sep 17 00:00:00 2001 From: jopamo Date: Thu, 21 Apr 2022 13:27:39 -0500 Subject: [PATCH 15/25] MenuItem: give ifNew valid default value --- src/Studio4/MenuItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Studio4/MenuItem.java b/src/Studio4/MenuItem.java index 1c9a9003d..550b56cc6 100644 --- a/src/Studio4/MenuItem.java +++ b/src/Studio4/MenuItem.java @@ -12,7 +12,7 @@ public MenuItem(String name, String price, String description, String category, this.price= price; this.description= description; this.category= category; - this.ifNew= ifNew; + this.ifNew= true; } // getters From 0f03551ee934928ea0375b9cb79920864aaf3370 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 25 Apr 2022 19:01:42 -0500 Subject: [PATCH 16/25] test commit of kristans code --- src/Studio4/Main | 34 +++++++++++++++++++++++++++++++ src/Studio4/Menu.java | 26 ++++++++++++++++++++++-- src/Studio4/MenuItem.java | 42 ++++++++++++++++++++------------------- 3 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 src/Studio4/Main diff --git a/src/Studio4/Main b/src/Studio4/Main new file mode 100644 index 000000000..aac8e1583 --- /dev/null +++ b/src/Studio4/Main @@ -0,0 +1,34 @@ +package Studio4; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Scanner; + +public class Main { + + public static void main(String[] args) { + System.out.println("in main"); + MenuItem itemOne = new MenuItem(14.99, "hamburger", "Entree"); +// System.out.println(itemOne.getDescription()); +// System.out.println(itemOne.getPrice()); +// System.out.println(itemOne.getCategory()); +// System.out.println(itemOne.isNew()); + MenuItem itemTwo = new MenuItem(5.99, "taco", "Entree"); +// System.out.println(itemTwo.getDescription()); +// System.out.println(itemTwo.getPrice()); +// System.out.println(itemTwo.getCategory()); +// System.out.println(itemTwo.isNew()); + + Menu restaurantMenuOne = new Menu(); + System.out.println(restaurantMenuOne); + System.out.println(restaurantMenuOne.getLastUpdated()); + System.out.println(restaurantMenuOne.getMenuItems()); + + Menu restaurantMenuTwo = new Menu(new ArrayList(Arrays.asList(itemOne, itemTwo))); + System.out.println(restaurantMenuTwo); + System.out.println(restaurantMenuTwo.getLastUpdated()); + System.out.println(restaurantMenuTwo.getMenuItems()); + + // I didn't test out my setters, but feel free! + } +} \ No newline at end of file diff --git a/src/Studio4/Menu.java b/src/Studio4/Menu.java index 72b2c7294..99d22f772 100644 --- a/src/Studio4/Menu.java +++ b/src/Studio4/Menu.java @@ -1,12 +1,34 @@ package Studio4; +import java.time.Instant; import java.util.ArrayList; +import java.util.Date; public class Menu { + private Date lastUpdated; + private ArrayList menuItems; - public static void main (String[] args){ - ArrayList restuarantMenu = new ArrayList<>(); + // an empty constructor, it just creates an empty list for the menuItems and uses the current time for lastUpdated + public Menu() { + this.lastUpdated = Date.from(Instant.now()); + this.menuItems = new ArrayList(); + } + + // a constructor that allows the user to create the menu with a pre-existing list of menuItems + public Menu(ArrayList items) { + this.lastUpdated = Date.from(Instant.now()); + this.menuItems = items; + } + + // getter for .lastUpdated + public Date getLastUpdated() { + return lastUpdated; + } + // getter for .getMenuItems() + public ArrayList getMenuItems() { + return menuItems; } + // no setters --- as of now I don't think there is any reason to overwrite the properties } diff --git a/src/Studio4/MenuItem.java b/src/Studio4/MenuItem.java index 550b56cc6..88b1634b1 100644 --- a/src/Studio4/MenuItem.java +++ b/src/Studio4/MenuItem.java @@ -1,51 +1,53 @@ package Studio4; public class MenuItem { - private String name; - private String price; + + private double price; private String description; private String category; - private boolean ifNew; + private boolean isNew = true; - public MenuItem(String name, String price, String description, String category, boolean ifNew) { - this.name= name; - this.price= price; - this.description= description; - this.category= category; - this.ifNew= true; - } - // getters - public double getName() { - return this.name; + public MenuItem(double price, String description, String category) { + this.price = price; + this.description = description; + this.category = category; + this.isNew = true; } + + // getter for .price public double getPrice() { return this.price; } + // getter for .description public String getDescription() { - return this.description; + return description; } + // getter for .category public String getCategory() { - return this.category; + return category; } - public boolean ifNew() { - return ifNew; + // getter for .isNew --> notice the syntax is a little different I didn't use getIsNew() -> just isNew() makes sense as it can only return either true or false + public boolean isNew() { + return isNew; } - // setters + // setter for .price() public void setPrice(double price) { this.price = price; } + // setter for .description public void setDescription(String description) { this.description = description; } - public void setifNew(boolean ifNew) { - this.ifNew = ifNew; + // setter for isNew + public void setNew(boolean isNew) { + this.isNew = isNew; } } From 65ab16ca152093e760404d325679b6530203e259 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 25 Apr 2022 19:25:14 -0500 Subject: [PATCH 17/25] kristan code commit --- src/{Studio4 => studio4}/Main | 3 +-- src/{Studio4 => studio4}/Menu.java | 4 ++-- src/{Studio4 => studio4}/MenuItem.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) rename src/{Studio4 => studio4}/Main (96%) rename src/{Studio4 => studio4}/Menu.java (98%) rename src/{Studio4 => studio4}/MenuItem.java (98%) diff --git a/src/Studio4/Main b/src/studio4/Main similarity index 96% rename from src/Studio4/Main rename to src/studio4/Main index aac8e1583..261a2e8c9 100644 --- a/src/Studio4/Main +++ b/src/studio4/Main @@ -1,8 +1,7 @@ -package Studio4; +package studio4; import java.util.ArrayList; import java.util.Arrays; -import java.util.Scanner; public class Main { diff --git a/src/Studio4/Menu.java b/src/studio4/Menu.java similarity index 98% rename from src/Studio4/Menu.java rename to src/studio4/Menu.java index 99d22f772..c2ffa0ff3 100644 --- a/src/Studio4/Menu.java +++ b/src/studio4/Menu.java @@ -1,4 +1,4 @@ -package Studio4; +package studio4; import java.time.Instant; import java.util.ArrayList; @@ -31,4 +31,4 @@ public ArrayList getMenuItems() { } // no setters --- as of now I don't think there is any reason to overwrite the properties -} +} \ No newline at end of file diff --git a/src/Studio4/MenuItem.java b/src/studio4/MenuItem.java similarity index 98% rename from src/Studio4/MenuItem.java rename to src/studio4/MenuItem.java index 88b1634b1..020418a9f 100644 --- a/src/Studio4/MenuItem.java +++ b/src/studio4/MenuItem.java @@ -1,4 +1,4 @@ -package Studio4; +package studio4; public class MenuItem { From 1a6c282975b3a9f864f19e477d90a5a8d3c6bb55 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 25 Apr 2022 19:46:53 -0500 Subject: [PATCH 18/25] fresh start --- src/restaurant/Menu.java | 13 +++++++++ src/{studio4 => restaurant}/MenuItem.java | 2 +- src/studio4/Main | 33 ---------------------- src/studio4/Menu.java | 34 ----------------------- 4 files changed, 14 insertions(+), 68 deletions(-) create mode 100644 src/restaurant/Menu.java rename src/{studio4 => restaurant}/MenuItem.java (98%) delete mode 100644 src/studio4/Main delete mode 100644 src/studio4/Menu.java diff --git a/src/restaurant/Menu.java b/src/restaurant/Menu.java new file mode 100644 index 000000000..02ab06faa --- /dev/null +++ b/src/restaurant/Menu.java @@ -0,0 +1,13 @@ +package restaurant; + +import java.util.ArrayList; + +public class Menu { + + public static void main (String[] args){ + ArrayList restuarantMenu = new ArrayList<>(); + System.out.println("Test"); + + } + +} diff --git a/src/studio4/MenuItem.java b/src/restaurant/MenuItem.java similarity index 98% rename from src/studio4/MenuItem.java rename to src/restaurant/MenuItem.java index 020418a9f..8b746760b 100644 --- a/src/studio4/MenuItem.java +++ b/src/restaurant/MenuItem.java @@ -1,4 +1,4 @@ -package studio4; +package restaurant; public class MenuItem { diff --git a/src/studio4/Main b/src/studio4/Main deleted file mode 100644 index 261a2e8c9..000000000 --- a/src/studio4/Main +++ /dev/null @@ -1,33 +0,0 @@ -package studio4; - -import java.util.ArrayList; -import java.util.Arrays; - -public class Main { - - public static void main(String[] args) { - System.out.println("in main"); - MenuItem itemOne = new MenuItem(14.99, "hamburger", "Entree"); -// System.out.println(itemOne.getDescription()); -// System.out.println(itemOne.getPrice()); -// System.out.println(itemOne.getCategory()); -// System.out.println(itemOne.isNew()); - MenuItem itemTwo = new MenuItem(5.99, "taco", "Entree"); -// System.out.println(itemTwo.getDescription()); -// System.out.println(itemTwo.getPrice()); -// System.out.println(itemTwo.getCategory()); -// System.out.println(itemTwo.isNew()); - - Menu restaurantMenuOne = new Menu(); - System.out.println(restaurantMenuOne); - System.out.println(restaurantMenuOne.getLastUpdated()); - System.out.println(restaurantMenuOne.getMenuItems()); - - Menu restaurantMenuTwo = new Menu(new ArrayList(Arrays.asList(itemOne, itemTwo))); - System.out.println(restaurantMenuTwo); - System.out.println(restaurantMenuTwo.getLastUpdated()); - System.out.println(restaurantMenuTwo.getMenuItems()); - - // I didn't test out my setters, but feel free! - } -} \ No newline at end of file diff --git a/src/studio4/Menu.java b/src/studio4/Menu.java deleted file mode 100644 index c2ffa0ff3..000000000 --- a/src/studio4/Menu.java +++ /dev/null @@ -1,34 +0,0 @@ -package studio4; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.Date; - -public class Menu { - private Date lastUpdated; - private ArrayList menuItems; - - // an empty constructor, it just creates an empty list for the menuItems and uses the current time for lastUpdated - public Menu() { - this.lastUpdated = Date.from(Instant.now()); - this.menuItems = new ArrayList(); - } - - // a constructor that allows the user to create the menu with a pre-existing list of menuItems - public Menu(ArrayList items) { - this.lastUpdated = Date.from(Instant.now()); - this.menuItems = items; - } - - // getter for .lastUpdated - public Date getLastUpdated() { - return lastUpdated; - } - - // getter for .getMenuItems() - public ArrayList getMenuItems() { - return menuItems; - } - - // no setters --- as of now I don't think there is any reason to overwrite the properties -} \ No newline at end of file From d477d7a2b41bd5193128d2967fb2a4b6112a1990 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 2 May 2022 18:57:00 -0500 Subject: [PATCH 19/25] fun with quizzes --- src/funWithQuizzes/question.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/funWithQuizzes/question.java diff --git a/src/funWithQuizzes/question.java b/src/funWithQuizzes/question.java new file mode 100644 index 000000000..e67975b6f --- /dev/null +++ b/src/funWithQuizzes/question.java @@ -0,0 +1,4 @@ +package funWithQuizzes; + +public class question { +} From 9013b12bf28c850364b0d4eb71e8551c0e9b6d4d Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 2 May 2022 19:16:47 -0500 Subject: [PATCH 20/25] created question class and subclasses --- src/funWithQuizzes/CheckBox.java | 8 ++++++++ src/funWithQuizzes/MultipleChoice.java | 4 ++++ src/funWithQuizzes/Question.java | 27 ++++++++++++++++++++++++++ src/funWithQuizzes/TrueFalse.java | 4 ++++ src/funWithQuizzes/question.java | 4 ---- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 src/funWithQuizzes/CheckBox.java create mode 100644 src/funWithQuizzes/MultipleChoice.java create mode 100644 src/funWithQuizzes/Question.java create mode 100644 src/funWithQuizzes/TrueFalse.java delete mode 100644 src/funWithQuizzes/question.java diff --git a/src/funWithQuizzes/CheckBox.java b/src/funWithQuizzes/CheckBox.java new file mode 100644 index 000000000..0fe8d63ab --- /dev/null +++ b/src/funWithQuizzes/CheckBox.java @@ -0,0 +1,8 @@ +package funWithQuizzes; + +public class CheckBox extends Question{ + + public Checkbox{ + + } +} diff --git a/src/funWithQuizzes/MultipleChoice.java b/src/funWithQuizzes/MultipleChoice.java new file mode 100644 index 000000000..b27db1ed6 --- /dev/null +++ b/src/funWithQuizzes/MultipleChoice.java @@ -0,0 +1,4 @@ +package funWithQuizzes; + +public class MultipleChoice extends Question{ +} diff --git a/src/funWithQuizzes/Question.java b/src/funWithQuizzes/Question.java new file mode 100644 index 000000000..7647e93d0 --- /dev/null +++ b/src/funWithQuizzes/Question.java @@ -0,0 +1,27 @@ +package funWithQuizzes; + +public class Question { + + private static Integer iD; + private Integer nextId = 1; + private String questions; + private String correctAnswer; + private boolean isCorrect; + +// public Question(String questions){ +// this.questions = questions; +// } + +// public Question(){ +// this.iD = nextId; +// nextId++; +// } + + public Question(String questions, String correctAnswer, boolean isCorrect){ + this.questions = questions; + this.correctAnswer = correctAnswer; + this.isCorrect = isCorrect; + this.iD = nextId; + nextId++; + } +} diff --git a/src/funWithQuizzes/TrueFalse.java b/src/funWithQuizzes/TrueFalse.java new file mode 100644 index 000000000..91654e971 --- /dev/null +++ b/src/funWithQuizzes/TrueFalse.java @@ -0,0 +1,4 @@ +package funWithQuizzes; + +public class TrueFalse extends Question { +} diff --git a/src/funWithQuizzes/question.java b/src/funWithQuizzes/question.java deleted file mode 100644 index e67975b6f..000000000 --- a/src/funWithQuizzes/question.java +++ /dev/null @@ -1,4 +0,0 @@ -package funWithQuizzes; - -public class question { -} From 859ebf1cd5bf7e65317b3a83593a30a50aac66a9 Mon Sep 17 00:00:00 2001 From: anjan Date: Mon, 2 May 2022 20:02:27 -0500 Subject: [PATCH 21/25] Finished creating the classes --- src/funWithQuizzes/CheckBox.java | 10 ++++++++-- src/funWithQuizzes/Main.java | 10 ++++++++++ src/funWithQuizzes/MultipleChoice.java | 11 ++++++++++- src/funWithQuizzes/{Question.java => Questions.java} | 11 ++++++----- src/funWithQuizzes/TrueFalse.java | 11 ++++++++++- 5 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/funWithQuizzes/Main.java rename src/funWithQuizzes/{Question.java => Questions.java} (67%) diff --git a/src/funWithQuizzes/CheckBox.java b/src/funWithQuizzes/CheckBox.java index 0fe8d63ab..8913263d0 100644 --- a/src/funWithQuizzes/CheckBox.java +++ b/src/funWithQuizzes/CheckBox.java @@ -1,8 +1,14 @@ package funWithQuizzes; -public class CheckBox extends Question{ +import java.util.ArrayList; - public Checkbox{ +public class CheckBox extends Questions{ + private ArrayList choices = new ArrayList<>(); + + + public CheckBox(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; } } diff --git a/src/funWithQuizzes/Main.java b/src/funWithQuizzes/Main.java new file mode 100644 index 000000000..91457c41f --- /dev/null +++ b/src/funWithQuizzes/Main.java @@ -0,0 +1,10 @@ +package funWithQuizzes; + +import java.util.Scanner; + +public class Main { + public static void main(String[] args){ + Scanner input = new Scanner(System.in) ; + //CheckBox checkBoxQ1 =new CheckBox("") + } +} diff --git a/src/funWithQuizzes/MultipleChoice.java b/src/funWithQuizzes/MultipleChoice.java index b27db1ed6..b4ed18b23 100644 --- a/src/funWithQuizzes/MultipleChoice.java +++ b/src/funWithQuizzes/MultipleChoice.java @@ -1,4 +1,13 @@ package funWithQuizzes; -public class MultipleChoice extends Question{ +import java.util.ArrayList; + +public class MultipleChoice extends Questions{ + private ArrayList choices = new ArrayList<>(); + + + public MultipleChoice(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; + } } diff --git a/src/funWithQuizzes/Question.java b/src/funWithQuizzes/Questions.java similarity index 67% rename from src/funWithQuizzes/Question.java rename to src/funWithQuizzes/Questions.java index 7647e93d0..063ea72bd 100644 --- a/src/funWithQuizzes/Question.java +++ b/src/funWithQuizzes/Questions.java @@ -1,10 +1,10 @@ package funWithQuizzes; -public class Question { +public class Questions { private static Integer iD; private Integer nextId = 1; - private String questions; + private String question; private String correctAnswer; private boolean isCorrect; @@ -17,11 +17,12 @@ public class Question { // nextId++; // } - public Question(String questions, String correctAnswer, boolean isCorrect){ - this.questions = questions; + public Questions(String question, String correctAnswer){ + this.question = question; this.correctAnswer = correctAnswer; - this.isCorrect = isCorrect; + //this.isCorrect = isCorrect; this.iD = nextId; nextId++; } + } diff --git a/src/funWithQuizzes/TrueFalse.java b/src/funWithQuizzes/TrueFalse.java index 91654e971..688c794e8 100644 --- a/src/funWithQuizzes/TrueFalse.java +++ b/src/funWithQuizzes/TrueFalse.java @@ -1,4 +1,13 @@ package funWithQuizzes; -public class TrueFalse extends Question { +import java.util.ArrayList; + +public class TrueFalse extends Questions { + private ArrayList choices = new ArrayList<>(); + + + public TrueFalse(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; + } } From 96a2fe7665a1d8e0bdee2563c1e56397e772951b Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 5 May 2022 18:58:03 -0500 Subject: [PATCH 22/25] created studio 7 --- src/studio7/CD.java | 4 ++++ src/studio7/DVD.java | 4 ++++ src/studio7/Main.java | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 src/studio7/CD.java create mode 100644 src/studio7/DVD.java create mode 100644 src/studio7/Main.java diff --git a/src/studio7/CD.java b/src/studio7/CD.java new file mode 100644 index 000000000..ab2b4b69b --- /dev/null +++ b/src/studio7/CD.java @@ -0,0 +1,4 @@ +package studio7; + +public class CD { +} diff --git a/src/studio7/DVD.java b/src/studio7/DVD.java new file mode 100644 index 000000000..938ad78fe --- /dev/null +++ b/src/studio7/DVD.java @@ -0,0 +1,4 @@ +package studio7; + +public class DVD { +} diff --git a/src/studio7/Main.java b/src/studio7/Main.java new file mode 100644 index 000000000..761a5d3f5 --- /dev/null +++ b/src/studio7/Main.java @@ -0,0 +1,8 @@ +package studio7; + +public class Main { + +public static void main (String[] args){ + + } +} From 5ddfdf990dc4f09d321d2b616e727dbe73c3d522 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 5 May 2022 18:59:12 -0500 Subject: [PATCH 23/25] created studio 7 with todos --- src/studio7/CD.java | 6 ++++++ src/studio7/DVD.java | 4 ++++ src/studio7/Main.java | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/studio7/CD.java b/src/studio7/CD.java index ab2b4b69b..88c1d2c17 100644 --- a/src/studio7/CD.java +++ b/src/studio7/CD.java @@ -1,4 +1,10 @@ package studio7; public class CD { + + // TODO: Implement your custom interface. + + // TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones + // need to be declared separately. + } diff --git a/src/studio7/DVD.java b/src/studio7/DVD.java index 938ad78fe..4a91807e1 100644 --- a/src/studio7/DVD.java +++ b/src/studio7/DVD.java @@ -1,4 +1,8 @@ package studio7; public class DVD { + // TODO: Implement your custom interface. + + // TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones + // need to be declared separately. } diff --git a/src/studio7/Main.java b/src/studio7/Main.java index 761a5d3f5..57a147168 100644 --- a/src/studio7/Main.java +++ b/src/studio7/Main.java @@ -4,5 +4,9 @@ public class Main { public static void main (String[] args){ + // TODO: Declare and initialize a CD and a DVD object. + + // TODO: Call each CD and DVD method to verify that they work as expected. + } } From 938bdfee7cca0bd9cce24099771ee48cceb44705 Mon Sep 17 00:00:00 2001 From: salev Date: Thu, 5 May 2022 20:02:41 -0500 Subject: [PATCH 24/25] implemented most of it --- src/restaurant/Menu.java | 2 +- src/studio7/BaseDisc.java | 59 ++++++++++++++++++++++++++++++++++++ src/studio7/CD.java | 14 ++++++++- src/studio7/DVD.java | 22 +++++++++++--- src/studio7/OpticalDisc.java | 7 +++++ 5 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 src/studio7/BaseDisc.java create mode 100644 src/studio7/OpticalDisc.java diff --git a/src/restaurant/Menu.java b/src/restaurant/Menu.java index 02ab06faa..780c83bc3 100644 --- a/src/restaurant/Menu.java +++ b/src/restaurant/Menu.java @@ -5,7 +5,7 @@ public class Menu { public static void main (String[] args){ - ArrayList restuarantMenu = new ArrayList<>(); + ArrayList restaurantMenu = new ArrayList<>(); System.out.println("Test"); } diff --git a/src/studio7/BaseDisc.java b/src/studio7/BaseDisc.java new file mode 100644 index 000000000..995beb918 --- /dev/null +++ b/src/studio7/BaseDisc.java @@ -0,0 +1,59 @@ +package studio7; + +public abstract class BaseDisc { + private String name; + private double storageCapacity = 10.0; + private String content; + private String diskType; + + public BaseDisc(String name, double storageCapacity, String content, String diskType) { + this.name = name; + this.storageCapacity = storageCapacity; + this.content = content; + this.diskType = diskType; + } + + public String writeData(double dataEntered) { + storageCapacity -= dataEntered; + return "You've used " + dataEntered + " kB."; + } + public String readData() { + return "You have " + storageCapacity + " kB left on this disc."; + } + + public String reportInfo() { + return "This disc is a " + diskType + " called " + name + " ."; + } + + public String getName() { + return name; + } + + public double getStorageCapacity() { + return storageCapacity; + } + + public String getContent() { + return content; + } + + public String getDiskType() { + return diskType; + } + + public void setName(String name) { + this.name = name; + } + + public void setStorageCapacity(double storageCapacity) { + this.storageCapacity = storageCapacity; + } + + public void setContent(String content) { + this.content = content; + } + + public void setDiskType(String diskType) { + this.diskType = diskType; + } +} diff --git a/src/studio7/CD.java b/src/studio7/CD.java index 88c1d2c17..0bf42fe25 100644 --- a/src/studio7/CD.java +++ b/src/studio7/CD.java @@ -1,6 +1,18 @@ package studio7; -public class CD { +public class CD extends BaseDisc implements OpticalDisc { + public CD(String name, double storageCapacity, String content, String diskType) { + super(name, storageCapacity, content, diskType); + } + @Override + public String spinDisk() { + return "Disc is spinning!"; + } + + @Override + public String storeData() { + return "Data is stored"; + } // TODO: Implement your custom interface. diff --git a/src/studio7/DVD.java b/src/studio7/DVD.java index 4a91807e1..d057f4f74 100644 --- a/src/studio7/DVD.java +++ b/src/studio7/DVD.java @@ -1,8 +1,22 @@ package studio7; -public class DVD { - // TODO: Implement your custom interface. +public class DVD extends BaseDisc implements OpticalDisc { + public DVD(String name, double storageCapacity, String content, String diskType) { + super(name, storageCapacity, content, diskType); + // TODO: Implement your custom interface. - // TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones - // need to be declared separately. + // TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones + // need to be declared separately. + + } + + @Override + public String spinDisk() { + return "Disc is spinning!"; + } + + @Override + public String storeData() { + return "Data is stored"; + } } diff --git a/src/studio7/OpticalDisc.java b/src/studio7/OpticalDisc.java new file mode 100644 index 000000000..ac65200a1 --- /dev/null +++ b/src/studio7/OpticalDisc.java @@ -0,0 +1,7 @@ +package studio7; + +public interface OpticalDisc { + String spinDisk(); + String storeData(); +} + From 45e2265fbebd0e93e5be19098994e3e225cd2119 Mon Sep 17 00:00:00 2001 From: salev Date: Thu, 5 May 2022 20:08:40 -0500 Subject: [PATCH 25/25] implemented it --- src/studio7/Main.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/studio7/Main.java b/src/studio7/Main.java index 57a147168..8af5c1e1c 100644 --- a/src/studio7/Main.java +++ b/src/studio7/Main.java @@ -5,8 +5,9 @@ public class Main { public static void main (String[] args){ // TODO: Declare and initialize a CD and a DVD object. - +DVD Titanic = new DVD("Titanic", 1000000000, "Movie", "DVD"); // TODO: Call each CD and DVD method to verify that they work as expected. - +System.out.println(Titanic.spinDisk()); + System.out.println(Titanic.readData()); } }