diff --git a/.classpath b/.classpath index 2cb9784..63b7e89 100644 --- a/.classpath +++ b/.classpath @@ -1,5 +1,6 @@ + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/NameFiles/Alec Gilroy b/NameFiles/Alec Gilroy new file mode 100644 index 0000000..b765df7 --- /dev/null +++ b/NameFiles/Alec Gilroy @@ -0,0 +1 @@ +Alec Gilroy \ No newline at end of file diff --git a/NameFiles/Alex Wissing b/NameFiles/Alex Wissing new file mode 100644 index 0000000..e51694f --- /dev/null +++ b/NameFiles/Alex Wissing @@ -0,0 +1 @@ +Alex Wissing \ No newline at end of file diff --git a/NameFiles/Corbin Babcock b/NameFiles/Corbin Babcock new file mode 100644 index 0000000..efa2991 --- /dev/null +++ b/NameFiles/Corbin Babcock @@ -0,0 +1 @@ +Corbin Babcock \ No newline at end of file diff --git a/NameFiles/Dawson Beutler b/NameFiles/Dawson Beutler new file mode 100644 index 0000000..96c974c --- /dev/null +++ b/NameFiles/Dawson Beutler @@ -0,0 +1 @@ +Je m'appelle Dawson. \ No newline at end of file diff --git a/NameFiles/Josh Hoogner b/NameFiles/Josh Hoogner new file mode 100644 index 0000000..017eb17 --- /dev/null +++ b/NameFiles/Josh Hoogner @@ -0,0 +1 @@ +Josh Hoogner \ No newline at end of file diff --git a/NameFiles/Nick Jones b/NameFiles/Nick Jones new file mode 100644 index 0000000..6d5a1ff --- /dev/null +++ b/NameFiles/Nick Jones @@ -0,0 +1 @@ +Nick Jones \ No newline at end of file diff --git a/src/Owen b/NameFiles/Owen similarity index 100% rename from src/Owen rename to NameFiles/Owen diff --git a/NameFiles/Schuyler b/NameFiles/Schuyler new file mode 100644 index 0000000..daad5ba --- /dev/null +++ b/NameFiles/Schuyler @@ -0,0 +1 @@ +Schuyler \ No newline at end of file diff --git a/NameFiles/Shane Flott b/NameFiles/Shane Flott new file mode 100644 index 0000000..4987fc4 --- /dev/null +++ b/NameFiles/Shane Flott @@ -0,0 +1 @@ +Shane Flott \ No newline at end of file diff --git a/NameFiles/Stephen Osborn b/NameFiles/Stephen Osborn new file mode 100644 index 0000000..4f6fff7 --- /dev/null +++ b/NameFiles/Stephen Osborn @@ -0,0 +1 @@ +Stephen Osborn \ No newline at end of file diff --git a/NameFiles/muehlich.txt b/NameFiles/muehlich.txt new file mode 100644 index 0000000..7c979e0 --- /dev/null +++ b/NameFiles/muehlich.txt @@ -0,0 +1,2 @@ +this is a test +aye bby diff --git a/README.md b/README.md index fa80cfd..dbd7640 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # StoreSim - AP Computer Science 2016 Repository for 2016 AP Computer Science class project. -Request access to the repo from the project managers. +Fork repo, edit, and pull request back to this repo. \ No newline at end of file diff --git a/src/Food.java b/src/Food.java deleted file mode 100644 index 6254f89..0000000 --- a/src/Food.java +++ /dev/null @@ -1,70 +0,0 @@ -public abstract class Food implements MerchandiseInterface { - protected String name; - protected double cost; - protected double oldCost; - protected int tempCostTime; - protected int storeCost; - protected int expiration; - protected int desirability; - protected int quantity; - protected boolean expired = false; - - public void setCost(double c) { - cost = c; - } - - public int getCost() { - return cost; - } - - public void changeCost(double c, int t) { - oldCost = cost; - cost = c; - tempCostTime = t; - } - - public void setStoreCost(double c) { - storeCost = c; - } - - public int getStoreCost() { - return storeCost; - } - - public void setExpiration(int days) { - //TODO Create a time system first - expiration = days /*+ currentTime*/; - } - - public int getExpiration() { - return expiration; - } - - public void setDesirability(int d) { - if(d >= 0 || d <= 2) { - desirability = d; - } else { - throw new Exception("Invalid desirability level"); - } - } - - public int getDesirability() { - return desirability; - } - - public void setName(String n) { - name = n; - } - - public String getName() { - return name; - } - - public void setQuantity(int q) { - quantity = q; - } - - public int getQuantity() { - return quantity; - } -} diff --git a/src/Runner.java b/src/Runner.java new file mode 100644 index 0000000..b3ffc3d --- /dev/null +++ b/src/Runner.java @@ -0,0 +1,23 @@ +import interfaces.food.CannedAppleSauce; +import interfaces.food.CannedApples; +import interfaces.food.Food; + +public class Runner { + + static CannedApples ca = new CannedApples(); + static CannedAppleSauce cas = new CannedAppleSauce(); + + static Food list[] = { ca, cas }; + + public static void main(String[] args) { + + for (Food f : list) { + System.out.println("Name: " + f.getName()); + System.out.println("Cost: " + f.getCost()); + System.out.println("Quantity: " + f.getQuantity()); + System.out.println("Expiration: " + f.getExpiration()); + System.out.println("\n\n"); + } + + } +} diff --git a/src/MerchandiseInterface.java b/src/interfaces/MerchandiseInterface.java similarity index 83% rename from src/MerchandiseInterface.java rename to src/interfaces/MerchandiseInterface.java index 358b3a8..71061d1 100644 --- a/src/MerchandiseInterface.java +++ b/src/interfaces/MerchandiseInterface.java @@ -1,15 +1,16 @@ +package interfaces; public interface MerchandiseInterface { /** * Set the cost of the item to the customer */ - int setCost(double cost); + void setCost(double cost); /** * Get the cost of the item to the customer * * @return int value cost */ - int getCost(); + double getCost(); /** * Temporarily change the cost of the item to the customer @@ -19,19 +20,19 @@ public interface MerchandiseInterface { /** * Set the cost of the item to the store */ - int setStoreCost(double cost); + void setStoreCost(double cost); /** * Get the cost of the item to the store * * @return int value storeCost */ - int getCost(); + double getStoreCost(); /** * Change the cost of the item to the store */ - void changeStoreCost(double cost); + void changeStoreCost(double cost, int time); /** * Set the date the item will expire based on day from now. diff --git a/src/interfaces/food/Almonds.java b/src/interfaces/food/Almonds.java new file mode 100644 index 0000000..a459d35 --- /dev/null +++ b/src/interfaces/food/Almonds.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Almonds extends Food { + public Almonds(){ + setName("Almonds"); + setCost(3.00); + setStoreCost(5.00); + setQuantity(10); + setExpiration(60); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Apples.java b/src/interfaces/food/Apples.java new file mode 100644 index 0000000..8fe5205 --- /dev/null +++ b/src/interfaces/food/Apples.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Apples extends Food{ + public Apples() { + setName("Apples"); + setCost(1.5); + setStoreCost(2.99); + setQuantity(30); + setExpiration(7); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Bacon.java b/src/interfaces/food/Bacon.java new file mode 100644 index 0000000..438a586 --- /dev/null +++ b/src/interfaces/food/Bacon.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Bacon extends Food { + public void Bacon(){ + setName("Bacon"); + setCost(0.50); + setStoreCost(6.00); + setQuantity(6); + setExpiration(7); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Bananas.java b/src/interfaces/food/Bananas.java new file mode 100644 index 0000000..6762b37 --- /dev/null +++ b/src/interfaces/food/Bananas.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Bananas extends Food { + public Bananas() { + setName("Bananas"); + setCost(1.99); + setStoreCost(3.99); + setQuantity(30); + setExpiration(7); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Beef.java b/src/interfaces/food/Beef.java new file mode 100644 index 0000000..1c5b8ae --- /dev/null +++ b/src/interfaces/food/Beef.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Beef extends Food { + public Beef() { + setDesirability(2); + setExpiration(14); + setName("Beef"); + setCost(3.99); + setStoreCost(1.50); + setQuantity(50); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Blueberries.java b/src/interfaces/food/Blueberries.java new file mode 100644 index 0000000..63f2eb8 --- /dev/null +++ b/src/interfaces/food/Blueberries.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Blueberries extends Food { + public Blueberries() { + setDesirability(1); + setExpiration(7); + setName("Blueberries"); + setCost(3.99); + setStoreCost(1.50); + setQuantity(5); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Butter.java b/src/interfaces/food/Butter.java new file mode 100644 index 0000000..20a793d --- /dev/null +++ b/src/interfaces/food/Butter.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Butter extends Food { + public void Butter() { + setName("Butter"); + setDesirability(3); + setExpiration(7); + setCost(2); + setStoreCost(3); + setQuantity(30); + } +} \ No newline at end of file diff --git a/src/interfaces/food/CannedAppleSauce.java b/src/interfaces/food/CannedAppleSauce.java new file mode 100644 index 0000000..946247d --- /dev/null +++ b/src/interfaces/food/CannedAppleSauce.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class CannedAppleSauce extends Food{ + public CannedAppleSauce() { + setName("Canned Apple Sauce"); + setCost(.7); + setStoreCost(.2); + setExpiration(365); + setDesirability(0); + setQuantity(100); + } +} \ No newline at end of file diff --git a/src/interfaces/food/CannedApples.java b/src/interfaces/food/CannedApples.java new file mode 100644 index 0000000..88fa127 --- /dev/null +++ b/src/interfaces/food/CannedApples.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class CannedApples extends Food{ + public CannedApples() { + setName("Canned Apples"); + setCost(.5); + setStoreCost(.1); + setExpiration(365); + setDesirability(0); + setQuantity(100); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Carrots.java b/src/interfaces/food/Carrots.java new file mode 100644 index 0000000..b33b043 --- /dev/null +++ b/src/interfaces/food/Carrots.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Carrots extends Food { + public Carrots() { + setName("Carrots"); + setCost(0.30); + setStoreCost(1.50); + setQuantity(30); + setExpiration(14); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/Cheetos.java b/src/interfaces/food/Cheetos.java similarity index 81% rename from src/Cheetos.java rename to src/interfaces/food/Cheetos.java index cd4eaff..8197f73 100644 --- a/src/Cheetos.java +++ b/src/interfaces/food/Cheetos.java @@ -1,4 +1,4 @@ -package org.mpsomaha.StoreSim; +package interfaces.food; public class Cheetos extends Food { public void Cheetos() { diff --git a/src/interfaces/food/Chicken_Fingers.java b/src/interfaces/food/Chicken_Fingers.java new file mode 100644 index 0000000..21e61e9 --- /dev/null +++ b/src/interfaces/food/Chicken_Fingers.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Chicken_Fingers extends Food{ + public void Chicken_Fingers(){ + setName("Chicken_Fingers"); + setCost(0.20); + setStoreCost(3.00); + setQuantity(5); + setExpiration(21); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/Chocolate.java b/src/interfaces/food/Chocolate.java similarity index 81% rename from src/Chocolate.java rename to src/interfaces/food/Chocolate.java index c247309..bcf9cb1 100644 --- a/src/Chocolate.java +++ b/src/interfaces/food/Chocolate.java @@ -1,4 +1,4 @@ -package org.mpsomaha.StoreSim; +package interfaces.food; public class Chocolate extends Food { public void Chocolate() { @@ -9,4 +9,4 @@ public void Chocolate() { setQuantity(50); setStoreCost(0.50); } -} +} \ No newline at end of file diff --git a/src/interfaces/food/Coffee.java b/src/interfaces/food/Coffee.java new file mode 100644 index 0000000..c93c352 --- /dev/null +++ b/src/interfaces/food/Coffee.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Coffee extends Food { + public Coffee() { + setName("Coffee"); + setCost(2.50); + setStoreCost(5.00); + setQuantity(12); + setExpiration(360); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Food.java b/src/interfaces/food/Food.java new file mode 100644 index 0000000..8b60a2a --- /dev/null +++ b/src/interfaces/food/Food.java @@ -0,0 +1,82 @@ +package interfaces.food; +import interfaces.MerchandiseInterface; + +public abstract class Food implements MerchandiseInterface { + protected String name; + protected double cost; + protected double oldCost; + protected double storeCost; + protected double oldStoreCost; + protected int tempCostTime; + protected int tempStoreCostTime; + protected int expiration; + protected int desirability; + protected int quantity; + protected boolean expired = false; + + public void setCost(double cost) { + this.cost = cost; + } + + public double getCost() { + return cost; + } + + public void changeCost(double cost, int time) { + oldCost = this.cost; + this.cost = cost; + tempCostTime = time; + } + + public void setStoreCost(double cost) { + storeCost = cost; + } + + public double getStoreCost() { + return storeCost; + } + + public void changeStoreCost(double cost, int time) { + oldStoreCost = storeCost; + storeCost = cost; + tempStoreCostTime = time; + } + + public void setExpiration(int days) { + //TODO Create a time system first + expiration = days /*+ currentTime*/; + } + + public int getExpiration() { + return expiration; + } + + public void setDesirability(int desirability) { + if(desirability >= 0 || desirability <= 2) { + this.desirability = desirability; + } else { + System.out.println("Invalid Desirability on " + name); + } + } + + public int getDesirability() { + return desirability; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public int getQuantity() { + return quantity; + } + +} diff --git a/src/interfaces/food/FrozenPizza.java b/src/interfaces/food/FrozenPizza.java new file mode 100644 index 0000000..82481af --- /dev/null +++ b/src/interfaces/food/FrozenPizza.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class FrozenPizza extends Food { + public FrozenPizza() { + setName("Frozen Pizza"); + setCost(4.00); + setStoreCost(2.00); + setQuantity(15); + setExpiration(30); + setDesirability(3); + } +} \ No newline at end of file diff --git a/src/interfaces/food/FruitSnacks.java b/src/interfaces/food/FruitSnacks.java new file mode 100644 index 0000000..a89a30d --- /dev/null +++ b/src/interfaces/food/FruitSnacks.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class FruitSnacks extends Food { + public void FruitSnacks() { + setName("Fruit Snacks"); + setDesirability(2); + setExpiration(31); + setCost(3); + setStoreCost(1); + setQuantity(10); + } +} \ No newline at end of file diff --git a/src/interfaces/food/HotPockets.java b/src/interfaces/food/HotPockets.java new file mode 100644 index 0000000..e12f5cb --- /dev/null +++ b/src/interfaces/food/HotPockets.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class HotPockets extends Food { + public void HotPockets() { + setName("Hot Pockets"); + setCost(2); + setStoreCost(1); + setQuantity(25); + setExpiration(3); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/interfaces/food/IceCream.java b/src/interfaces/food/IceCream.java new file mode 100644 index 0000000..cb246e8 --- /dev/null +++ b/src/interfaces/food/IceCream.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class IceCream extends Food { + public void IceCream() { + setName("Chicken_Fingers"); + setCost(0.20); + setStoreCost(3.00); + setQuantity(5); + setExpiration(21); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/interfaces/food/PancakeMix.java b/src/interfaces/food/PancakeMix.java new file mode 100644 index 0000000..18970a1 --- /dev/null +++ b/src/interfaces/food/PancakeMix.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class PancakeMix extends Food{ + public PancakeMix() { + setName("Pancake Mix"); + setCost(3.99); + setStoreCost(1.72); + setQuantity(11); + setExpiration(30); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Pie.java b/src/interfaces/food/Pie.java new file mode 100644 index 0000000..4c1740e --- /dev/null +++ b/src/interfaces/food/Pie.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Pie extends Food { + public void Pie() { + setDesirability(1); + setCost(5.00); + setStoreCost(7.29); + setQuantity(21); + setExpiration(7); + setName("Pie"); + } +} \ No newline at end of file diff --git a/src/interfaces/food/PieMix.java b/src/interfaces/food/PieMix.java new file mode 100644 index 0000000..eeaaa16 --- /dev/null +++ b/src/interfaces/food/PieMix.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class PieMix extends Food { + public void PieMix() { + setDesirability(1); + setCost(2.00); + setStoreCost(4.00); + setQuantity(15); + setExpiration(186); + setName("Pie Mix"); + } +} \ No newline at end of file diff --git a/src/interfaces/food/PizzaRolls.java b/src/interfaces/food/PizzaRolls.java new file mode 100644 index 0000000..e093a32 --- /dev/null +++ b/src/interfaces/food/PizzaRolls.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class PizzaRolls extends Food { + public void PizzaRolls() { + setName("Pizza Rolls"); + setCost(5); + setStoreCost(2); + setQuantity(20); + setExpiration(5); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Popcorn.java b/src/interfaces/food/Popcorn.java new file mode 100644 index 0000000..215ca19 --- /dev/null +++ b/src/interfaces/food/Popcorn.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Popcorn extends Food { + public Popcorn() { + setName("Popcorn"); + setCost(2.99); + setStoreCost(4.99); + setQuantity(15); + setExpiration(120); + setDesirability(1); + } +} diff --git a/src/interfaces/food/Pork.java b/src/interfaces/food/Pork.java new file mode 100644 index 0000000..52bb3c3 --- /dev/null +++ b/src/interfaces/food/Pork.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Pork extends Food { + public Pork(){ + setName("Pork"); + setCost(2.00); + setStoreCost(5.00); + setQuantity(20); + setExpiration(21); + setDesirability(2); + } +} \ No newline at end of file diff --git a/src/Ramen.java b/src/interfaces/food/Ramen.java similarity index 79% rename from src/Ramen.java rename to src/interfaces/food/Ramen.java index 8fb5aa0..f67aff9 100644 --- a/src/Ramen.java +++ b/src/interfaces/food/Ramen.java @@ -1,4 +1,4 @@ -package org.mpsomaha.StoreSim; +package interfaces.food; public class Ramen extends Food{ public void Ramen() { @@ -8,6 +8,5 @@ public void Ramen() { setCost(1.00); setQuantity(50); setStoreCost(0.10); - } -} +} \ No newline at end of file diff --git a/src/interfaces/food/Spaghetti.java b/src/interfaces/food/Spaghetti.java new file mode 100644 index 0000000..aeafce3 --- /dev/null +++ b/src/interfaces/food/Spaghetti.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Spaghetti extends Food { + public void Spaghetti() { + setName("Spaghetti"); + setDesirability(3); + setExpiration(30); + setCost(3); + setStoreCost(1); + setQuantity(20); + } +} \ No newline at end of file diff --git a/src/interfaces/food/Strawberries.java b/src/interfaces/food/Strawberries.java new file mode 100644 index 0000000..88445ae --- /dev/null +++ b/src/interfaces/food/Strawberries.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class Strawberries extends Food { + public Strawberries() { + setDesirability(2); + setExpiration(7); + setName("Strawberries"); + setCost(4.99); + setStoreCost(1.50); + setQuantity(15); + } +} \ No newline at end of file diff --git a/src/interfaces/food/WhippedCream.java b/src/interfaces/food/WhippedCream.java new file mode 100644 index 0000000..d3d20de --- /dev/null +++ b/src/interfaces/food/WhippedCream.java @@ -0,0 +1,12 @@ +package interfaces.food; + +public class WhippedCream extends Food { + public WhippedCream(){ + setName("Whipped Cream"); + setCost(0.40); + setStoreCost(1.00); + setQuantity(20); + setExpiration(7); + setDesirability(1); + } +} \ No newline at end of file diff --git a/src/interfaces/otherProducts/TherapeuticToiletPaper.java b/src/interfaces/otherProducts/TherapeuticToiletPaper.java new file mode 100644 index 0000000..77a48bc --- /dev/null +++ b/src/interfaces/otherProducts/TherapeuticToiletPaper.java @@ -0,0 +1,15 @@ +package interfaces.otherProducts; +import interfaces.food.Food; + +//////TALK TO SKYLAR\\\\\\ + +public class TherapeuticToiletPaper extends Food{ + public TherapeuticToiletPaper() { + setName("Therapeutic Toilet Paper"); + setCost(1.0); + setStoreCost(.5); + setExpiration(3); + setDesirability(3); + setQuantity(100); + } +} \ No newline at end of file diff --git a/src/runner.java b/src/runner.java deleted file mode 100644 index ead8df0..0000000 --- a/src/runner.java +++ /dev/null @@ -1,9 +0,0 @@ - -public class runner { - - public static void main(String[] args) { - - - } - -} \ No newline at end of file diff --git a/test.txt b/test.txt deleted file mode 100644 index e66448f..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -Nice!