From b85b417281fe9cb93d23e71a500e502e371cf0b4 Mon Sep 17 00:00:00 2001
From: Sean Islas <seanislas@whiteoakfarmandranch.com>
Date: Thu, 1 Jun 2023 14:47:50 -0700
Subject: [PATCH] Adding Project files - Islas

---
 .DS_Store                                     | Bin 0 -> 8196 bytes
 assignments/.DS_Store                         | Bin 0 -> 6148 bytes
 assignments/src/.DS_Store                     | Bin 0 -> 8196 bytes
 .../src/MV3500Cohort2023MarchJune/.DS_Store   | Bin 0 -> 6148 bytes
 .../projects/.DS_Store                        | Bin 0 -> 6148 bytes
 .../projects/Islas/Client_Customer.java       |  54 +++++++++++++
 .../projects/Islas/Client_Farm.java           |  50 ++++++++++++
 .../projects/Islas/Customer.java              |  56 ++++++++++++++
 .../projects/Islas/FarmStore.java             |  69 +++++++++++++++++
 .../projects/Islas/LivestockRanch.java        |  57 ++++++++++++++
 .../projects/Islas/Server.java                |  72 ++++++++++++++++++
 11 files changed, 358 insertions(+)
 create mode 100644 .DS_Store
 create mode 100644 assignments/.DS_Store
 create mode 100644 assignments/src/.DS_Store
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/.DS_Store
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/.DS_Store
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Customer.java
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Farm.java
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Customer.java
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/FarmStore.java
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/LivestockRanch.java
 create mode 100644 assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Server.java

diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..a4fe3c6977171123955ae583411384d21a0bdf93
GIT binary patch
literal 8196
zcmeHM!EVz)5S?vH>nIcjsYtybS>lGO5YiM0aS0(kfas;J$^lS_W4Cp2><~LmQB^5t
z_!T6sd<p-;3Eu3w!Rs^<2UJz+ZnQg_^}N}cH*33-5|L<)yvIcAL}a0}tduca()c>}
znYNIvtU(Iki2^zy|795W+;B$QEEon11BL;^fMLKea2*)HJDZy|=e@74n$a*|7`TxP
z@bke&XW7i;L`nJRz#vNi$R#YxhB@j0iLo=;%;ZE#3588nJ%|h{vJyimIIi2Q4%y7)
zL`elFq2MI4okdom2)R3Owp1t4RML!w0mHy716;eWP?v_(qoaKN9=o{0H`8<U>TlUF
zBPv5X!6%?Yil|RM#*`9O^-odX{|)7ilYtvb)DL$M21#10{S*s}OShI+tQD(ly?2h{
zv6FVwQPS!T-}1M;I1b&5dDq<!{BftU_9BkbZV>rH2?#tND(~I|kr$6!@hI{ViFMQk
zt7MfrmG!f;M!mjaHyZWx4g2hAy@vVblk@YEb??EWXS<z`VLyt$$f!wV4<1@o->2hO
z%;s=%;tZoOjt-&0=n}a!0&gLCRHajJ7wW8u`_R(4?okYW55V$JGTp;i;99T;dDLCl
z50If0m_Y8CLb9DIa-3eW@2`S|Ral5|B1Y5vc7c;NbdMJ}w*1}}{5!=7>C*sl&iE=%
z)3@AdT7(vS)U6Vqp1js=sl~BJh|8ZF2lJQ5m1l4%yi4`nB!79-7VXeJZPFIi@M*(8
zol76=I9Tn2pAfNLu<OugeCHL;b3%2X>#(zf6?K2T!g?hASNxt9JmEa#J!xElCj&%t
zp!*@Sn)jmwuU%wxh*NP4|9eFaIj`bjF0aeb_7LrBAP#lwoLx<KRa(Ybk@-z?j22Hi
z@~a_Bv`gFAyA7VUaVq-c>3eZ*HN+k4GLR7jxT^w0@;86Q-H;6pTcJHf;{w%zl~0I{
z^U9~83Y$?ePG(WVBe|v-2CfYQi^`LAuK%~^|Neh%{56gk1`GrLp8>JdcG@l2z4#Ni
zxCPhRHu?v2Zmc&^QbI7uavV~Y<B-#T7-DWil`+jsPL#w7+LiwhVBY_dcQf2<2L1pA
Cfsrl%

literal 0
HcmV?d00001

diff --git a/assignments/.DS_Store b/assignments/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..a308dd9de4b911c6cf89af7d62423a9a192ba664
GIT binary patch
literal 6148
zcmeHKO^ee&7=EX%-NZ#GsIV6y;B~3B7D2qkZdX{)%SQB|Qj;dsXgX7xbgPs?&iYpb
zul^GMizj{Nqp(TW>*C71F!RjE^UTLnGSeX<HeAN{i8@5&AW3XpM|MHTewlWnVOm@u
zQ)9%`rB5`Y>?GS^+Xm}^b>LrfKz_R}MYN=pGCKGDib<4-2)*)Xc!JdZtpX*YHrO)?
zX-Wy@Cs~F2y~cHkWBfTSNYDrHCsb4w>`qP520O-zo<T9Kalh8ME}hab);FT(z%Eu5
z*A%~Mikna*m_cAg1@^(Qi>InK!kh(tzG#%jv^GkUa_A@3xs*@e&iQ0m(JG%CH-AL)
zEX|8v?<Z?CTi4oq&YrXHyba!qRZxV*G9QME*Ru9Ph%DNc!{}w2tj3*NM}ik&%9Di>
zq;Ueun^!51#cC*)JkFIi&>fEJxZ}>jdOhg(552*lzd7{QkNQ27A3WS_T<7-Pdyh}Y
zAF~-3U$8#}!#S?vhQTdJ-_35$f(6e6myT@NTb9ME<be70oc*h`XuDSHfOX(f9FXUO
zha}NASZY*92Qu{p0JhMq0%iG!L25jMzQIx>dJs%Yfm+JU6N70v+C9Vb4VD_UoS1oh
zFf%hVFBGO`$M~M26Z19N+&W+#s5;Qp)sDRXkN^JuuZnEVI$$06uN+{lQ7{@}OXhCf
y*_^y<J*0O?G9<6ms3geDb*u{VDn39`fj&<bfWE;}BU%vlkASklX4ZjAb>I)Ms-;~3

literal 0
HcmV?d00001

diff --git a/assignments/src/.DS_Store b/assignments/src/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..8f370ce20024e01626b607bebd4111933ec46cae
GIT binary patch
literal 8196
zcmeHM!EVz)6nvWo>Zq!e1Bf6|$r9J9Bu+q7Tuj;=K;lxPasU+K#v&1p9XU>;DvIPY
z{0b6RzJ!0_1oL*6Do#^KdO%d{i}uZWy)$-ZZEw~gBGDXoYeW?yvQQYyTS!ZS_j9=r
z1>M3t0X|U`p96}ihhoAwU>q<G7zd04#({s)0nFJP)+O`4+H10Lz&P+<I>65d8->x;
zm?@Nx4kWn*02a|K19hweB*)h1YRnW$Dm2yVL1?PbOAMjt*l%-ppsO)csOTgVorFHJ
z&?^)nj}D$KyOVGgnrs{}4qSAA=l*;2f{v+94|D7Hgi><QQlrQ8oH`WI7&)Oc^kzJv
z-m@@1@x$1M2H$p1QTBewK#gc;1>G@)Q1mFEA&wW&fPCa+LHWy?%KJFum6XNKTFUIl
zs>+|%RIaV8{Cz?B&ToBoFp4~4XHq|+An$GA{es%vKd9BEnjHV-it;-6Ja-*jLD8R#
zhWg6->JP*ID6Lk%iNZ$l#?4J@)7rA$dcAn!rJZy<YIc&>y!A4UL;qL3;~)2fNxOXO
zAdb>bKME2_=ywBjdGo3tb>m4h9!K4g<a%m{RkBL$a%DPgIL@x!XgIT7d%EvbQLjIm
z%}Uno`wyNRwLgS|DE<iF5JFE#w5_(!GmrljzWJ$_L}489sIc-j-lU!K9f8~jPG}Er
z*HYXkVSXHm?~!@eOLRmnjKv|ws|D78x_O4Y_U9Q8$ORwYMqzX{W(v89+vO|_H1j_j
zV!}9ZjU3oe=UU<40Ikd4|6ikTWKPvMU>sQ20Z}~k4x3=fS$zqcXL%dt9SR5c%M?lq
iQtpQUw$J}CMBPSL=C~R&g=j&T7Xi`+lZ*p@)q$Temi!(7

literal 0
HcmV?d00001

diff --git a/assignments/src/MV3500Cohort2023MarchJune/.DS_Store b/assignments/src/MV3500Cohort2023MarchJune/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..a506183143edd57a28f7eb7f1281d354078197fe
GIT binary patch
literal 6148
zcmeHK!EVz)5S>i}T~i_D08%fNEOD($>PAS2iyP8I4_s;l2S6dNBWmh;qu9ZRD3Z_g
zW4Q7q{0k>|v%8h*q$md@grXg3_U-P>vo+85u9t{Jf0i5)b%;p98QTxg++iGNU$K^*
z;h@mhs7TS2F6r<zTgi44P64OD|E2(cyB=NOyS<_@-THpjd7P;jQC=F3;RnC8p?4P}
zIL#W2Z)+JxO@`Q8%jhjJu9p~+CRlwGeMTkcR8p~&|8re_Ton^r_4jy^rA688{t&IL
z_PzVta$D}m57C9HqH<KuivDQ&jz_PR%Ho^;D1MWUt6}HSOO=<SG#^hjAx*|edH*)e
z6IJ!qEKdr}jZ8p#(i?Vm=ks0=?EAf5u-NzK&x0=dN6!`uPd<L~^u^imGP}yvSJVI#
zSZ}pGw0Hxo$%+nNqG_I~{1al#^XQCD@Jt8v3V47gpEQ+fapvvkjiIxRQ^3AMa%bZz
za|JmCoC1HV0Iv@|oH4Xm8`Mh&8hr!+wlS>@eg0u!j&CuvSQ|tHCJYs5sKOpGgrQ^J
zw|Sw(+MuD6u!j#}?=0*IMd-WZ`o2yl5gK%@Q@|<ERA9>tJG}p&{Q3OfB)O4Oz$vg%
z3W)X~8uU?;-CI|R<Gt30e}uDfUTsiQ(Ae!*cX%t_g=<61=MFHmSR2F)%>4*x8C>HO
I_@@f|2FaY9bN~PV

literal 0
HcmV?d00001

diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/.DS_Store b/assignments/src/MV3500Cohort2023MarchJune/projects/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..80878e3412d0634604e7b9926bedb652267797ee
GIT binary patch
literal 6148
zcmeHKL2uJA6n^enmS{pM5=grsMdCV2DHRghC6w;41D6HC0Z>VnGQzUBYTETsRmyq$
zF<kj2{2ln7?V*&ywF2~>^!(Y+?~9YqmK_t38qCwjL~SDS;EW9)#cz!J**C1=A}ydY
z&nS;`eVXJt*~pc^->Cr4U5k#Xq?}@^&mS*|=kU&VW9Id1naQG@xS9T%O!BOpb-UkG
zW2f1=wd?JAd*1u#lU_u#cs4Hw@$@aXUTK{tH}yDqosAcx_T3k{n8jH!o*F`yj*;^2
zO;)6OG0^iOEe$ua9iH#`qxSxC+3)oZf_}fZItZ4}dR^3?JYB7P@7{w)hbN=+{G!lT
z=AB7lZ5q4n@CL3?seRF9G%a#noFU4LJ2ZhJr*w|;jK=hkGAigJY3k5t#4ahWt#(%H
z3%stDPbYK)4Ttm+*r5wb*BR>mFAOxrL;+Di6xf0SZeR5FwlJ0qAqt2B|CR#0KLl{b
z&|ziKY#k`f6#&>o*cj^kE5w|@Vd${3h#r`-RG_6Qcg0Yaj(FhmLWh+_ODE+nAIgoa
z+zmyU(eeDiq>~CQN+}A60_zIw*k+s0|D!+O|JO;<5(Pwo|4ISX97e+dKFOV}8z0AK
uZ2<oOXXCue;!g@H<|sxkAI1A{V~7V_0fr7Mi-^GFN5IG+g($F91%3c84|3)J

literal 0
HcmV?d00001

diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Customer.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Customer.java
new file mode 100644
index 0000000000..ce0d4e839d
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Customer.java
@@ -0,0 +1,54 @@
+import java.io.*;
+import java.net.*;
+
+public class Client_Customer {
+    public static void main(String[] args) {
+
+        // TODO - Fill out the following questionairre: 
+
+        double averageBeefPurchase = 2; // How many pounds of beef do you typically purchase when you buy groceries?
+        double averageVariationInBeefPurchase = 0.5; // How much do you typically vary from the above amount (also in pounds)?
+
+        double averagePorkPurchase = 4; // How many pounds of pork do you typically purchase when you buy groceries?
+        double averageVariationInPorkPurchase = 0.5; // How much do you typically vary from the above amount (also in pounds)?
+
+        double averageChickenPurchase = 6; // How many pounds of chicken do you typically purchase when you buy groceries?
+        double averageVariationInChickenPurchase = 0.5; // How much do you typically vary from the above amount (also in pounds)?
+
+        double averageEggsPurchase = 2; // How many eggs do you typically purchase when you buy groceries (amount in dozens)?
+        double averageVariationInEggsPurchase = 0.5; // How much do you typically vary from the above amount (also in dozens)?
+
+        // End of TODO section
+
+        Customer myCustomer = new Customer(averageBeefPurchase, averageVariationInBeefPurchase, averagePorkPurchase, averageVariationInPorkPurchase, averageChickenPurchase, averageVariationInChickenPurchase, averageEggsPurchase, averageVariationInEggsPurchase);
+
+        try {
+            // Create client socket and connect to the server
+            Socket clientSocket = new Socket("localhost", 12345);
+            System.out.println("Connected to server.");
+
+            // Send request to server
+            PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
+            String request = "doTransaction," + myCustomer.getBeefPreference().generate() + "," + myCustomer.getPorkPreference().generate() + "," + myCustomer.getChickenPreference().generate() + "," + myCustomer.getEggsPreference().generate();
+            out.println(request);
+            System.out.println("Sent request to server: " + request);
+
+            // Receive response from server
+            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
+            StringBuilder responseBuilder = new StringBuilder();
+            String line;
+            while ((line = in.readLine()) != null) {
+                responseBuilder.append(line).append("\n");
+            }
+            String response = responseBuilder.toString();
+            System.out.print("Received response from server: " + response);
+
+            // Close connections
+            in.close();
+            out.close();
+            clientSocket.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Farm.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Farm.java
new file mode 100644
index 0000000000..f5385a7da7
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Client_Farm.java
@@ -0,0 +1,50 @@
+import java.io.*;
+import java.net.*;
+
+public class Client_Farm {
+    public static void main(String[] args) {
+
+        // TODO - Fill out the following questionairre: 
+
+        int cattleCount = 50; // How many cows are on the farm?
+
+        int pigCount = 50; // How many pigs are on the farm?
+
+        int broilerChickenCount = 300; // How many broiler chickens (think supermarket chickens - they don't lay eggs) are on the farm?
+
+        int layerChickenCount = 500; // How many egg laying chickens are on the farm?
+
+        // End of TODO section
+
+        LivestockRanch myFarm = new LivestockRanch(cattleCount, pigCount, broilerChickenCount, layerChickenCount);
+
+        try {
+            // Create client socket and connect to the server
+            Socket clientSocket = new Socket("localhost", 12345);
+            System.out.println("Connected to server.");
+
+            // Send request to server
+            PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
+            String request = "doResupply," + myFarm.getCattleProcessRate() + "," + myFarm.getPigProcessRate() + "," + myFarm.getChickenProcessRate() + "," + myFarm.getEggLayingRate();
+            out.println(request);
+            System.out.println("Sent request to server: " + request);
+
+            // Receive response from server
+            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
+            StringBuilder responseBuilder = new StringBuilder();
+            String line;
+            while ((line = in.readLine()) != null) {
+                responseBuilder.append(line).append("\n");
+            }
+            String response = responseBuilder.toString();
+            System.out.print("Received response from server: " + response);
+
+            // Close connections
+            in.close();
+            out.close();
+            clientSocket.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Customer.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Customer.java
new file mode 100644
index 0000000000..1ae3e48540
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Customer.java
@@ -0,0 +1,56 @@
+import simkit.SimEntityBase;
+import simkit.random.RandomVariate;
+import simkit.random.RandomVariateFactory;
+
+public class Customer extends SimEntityBase{
+    private RandomVariate beefPreference;
+    private RandomVariate porkPreference;
+    private RandomVariate chickenPreference;
+    private RandomVariate eggsPreference; 
+
+    public Customer(double averagePurchaseOfBeef, double beefPlusMinus, double averagePurchaseOfPork, double porkPlusMinus, double averagePurchaseOfChicken, double chickenPlusMinus, double averagePurchaseOfEggs, double eggsPlusMinus) {
+        this.beefPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfBeef, beefPlusMinus);
+        this.porkPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfPork, porkPlusMinus);
+        this.chickenPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfChicken, chickenPlusMinus);
+        this.eggsPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfEggs, eggsPlusMinus);
+    }
+
+    public void doRun() {
+        waitDelay("Transaction", 0.0);
+    }
+
+    public void doTransaction() {
+        double beef = beefPreference.generate();
+        beef = beef < 0 ? 0 : beef;
+
+        double pork = porkPreference.generate();
+        pork = pork < 0 ? 0 : pork;
+
+        double chicken = chickenPreference.generate();
+        chicken = chicken < 0 ? 0 : chicken;
+
+        double eggs = eggsPreference.generate();
+        eggs = eggs < 0 ? 0 : eggs;
+
+        waitDelay("Transaction", 0.0, beef, pork, chicken, eggs);
+        waitDelay("Transaction", 7.0);
+    }
+
+    public RandomVariate getBeefPreference() {
+        return beefPreference;
+    }
+
+    public RandomVariate getPorkPreference() {
+        return porkPreference;
+    }
+
+    public RandomVariate getChickenPreference() {
+        return chickenPreference;
+    }
+
+    public RandomVariate getEggsPreference() {
+        return eggsPreference;
+    }
+
+    
+}
diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/FarmStore.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/FarmStore.java
new file mode 100644
index 0000000000..b099bc6bb7
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/FarmStore.java
@@ -0,0 +1,69 @@
+import java.text.DecimalFormat;
+
+public class FarmStore {
+    private double bankAccount;
+    private double BEEFCOST = 10; // Cost per pound
+    private double PORKCOST = 5; // Cost per pound
+    private double CHICKENCOST = 2; // Cost per pound
+    private double EGGSCOST = 2; // Cost per dozen
+    
+    protected double beefQuantity; // Quantity in pounds
+    protected double porkQuantity; // Quantity in pounds
+    protected double chickenQuantity; // Quantity in pounds
+    protected double eggQuantity; // Quantity in dozens
+
+    public FarmStore() {
+        this.bankAccount = 0;
+        this.beefQuantity = 0;
+        this.porkQuantity = 0;
+        this.chickenQuantity = 0;
+        this.eggQuantity = 0;
+    }
+
+    public String doTransaction(double beef, double pork, double chicken, double eggs) {
+        DecimalFormat df = new DecimalFormat("#.##");
+
+        if (this.beefQuantity < beef) {
+            beef = Math.max(this.beefQuantity, 0);
+            System.out.println("We are out of beef");
+        }
+        else {beef = Double.parseDouble(df.format(beef));}
+        if (this.porkQuantity < pork) {
+            pork = Math.max(this.porkQuantity, 0);
+            System.out.println("We are out of pork");
+        }
+        else {pork = Double.parseDouble(df.format(pork));}
+        if (this.chickenQuantity < chicken) {
+            chicken = Math.max(this.chickenQuantity, 0);
+            System.out.println("We are out of chicken");
+        }
+        else {chicken = Double.parseDouble(df.format(chicken));}
+        if (this.eggQuantity < eggs) {
+            eggs = Math.max(this.eggQuantity, 0);
+            System.out.println("We are out of eggs");
+        }
+        else {eggs = Double.parseDouble(df.format(eggs));}
+
+        this.beefQuantity -= beef;
+        this.porkQuantity -= pork;
+        this.chickenQuantity -= chicken;
+        this.eggQuantity -= eggs;
+
+        double cost = beef * BEEFCOST + pork * PORKCOST + chicken * CHICKENCOST + eggs * EGGSCOST;
+        cost = Double.parseDouble(df.format(cost));
+        this.bankAccount += cost;
+
+        return "Product purchased:\nBeef: " + beef  + " lbs\nPork: " + pork  + " lbs\nChicken: " + chicken  + " lbs\nEggs: " + eggs  + " dozen\nTransaction total: $" + cost;
+    }
+
+    public String doResupply(double beef, double pork, double chicken, double eggs) {
+        this.beefQuantity += beef;
+        this.porkQuantity += pork;
+        this.chickenQuantity += chicken;
+        this.eggQuantity += eggs;
+
+        return "Product received:\nBeef: " + beef  + " lbs\t\tCurrent Stock: " + beefQuantity + " lbs\nPork: " + pork  
+        + " lbs\tCurrent Stock: " + porkQuantity + " lbs\nChicken: " + chicken  + " lbs\tCurrent Stock: " + chickenQuantity 
+        + " lbs\nEggs: " + eggs  + " dozen\tCurrent Stock: " + eggQuantity + " dozen\nCurrent Profit: $" + bankAccount;
+    }
+}
\ No newline at end of file
diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/LivestockRanch.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/LivestockRanch.java
new file mode 100644
index 0000000000..5db0ee6498
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/LivestockRanch.java
@@ -0,0 +1,57 @@
+public class LivestockRanch {
+    private int totalCattle;
+    private int totalPigs;
+    private int totalBroilerChickens; 
+    private int totalLayerChickens;
+
+    private double cattleProcessRate;
+    private double pigProcessRate;
+    private double chickenProcessRate;
+    private double eggLayingRate;
+
+    public LivestockRanch (int totalCattle, int totalPigs, int totalBroilerChickens, int totalLayerChickens) {
+        this.totalCattle = totalCattle;
+        this.totalPigs = totalPigs;
+        this.totalBroilerChickens = totalBroilerChickens;
+        this.totalLayerChickens = totalLayerChickens;
+
+        this.cattleProcessRate = totalCattle * 500 / (3 * 12); // Processing 1/3 of  the total population per year, 1 per month, at 500 lbs of beef per cow
+        this.pigProcessRate = totalPigs * 150 / 6; // Processing 1/6 of the total population per month, at 150 lbs of pork per pig
+        this.chickenProcessRate = totalBroilerChickens * 6 / 3; // Processing 1/3 of the total population per month, at 6 lbs per chicken
+        this.eggLayingRate = totalLayerChickens * (25 / 12); // 25 eggs per layer chicken (divided by 12 to be sold in dozens)
+    }
+
+    public int getTotalCattle() {
+        return totalCattle;
+    }
+
+    public int getTotalPigs() {
+        return totalPigs;
+    }
+
+    public int getTotalBroilerChickens() {
+        return totalBroilerChickens;
+    }
+
+    public int getTotalLayerChickens() {
+        return totalLayerChickens;
+    }
+
+    public double getCattleProcessRate() {
+        return cattleProcessRate;
+    }
+
+    public double getPigProcessRate() {
+        return pigProcessRate;
+    }
+
+    public double getChickenProcessRate() {
+        return chickenProcessRate;
+    }
+
+    public double getEggLayingRate() {
+        return eggLayingRate;
+    }
+
+    
+}
diff --git a/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Server.java b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Server.java
new file mode 100644
index 0000000000..ed276501a8
--- /dev/null
+++ b/assignments/src/MV3500Cohort2023MarchJune/projects/Islas/Server.java
@@ -0,0 +1,72 @@
+import java.io.*;
+import java.net.*;
+
+public class Server {
+    public static void main(String[] args) {
+
+        FarmStore market = new FarmStore();
+        try {
+            // Create server socket
+            ServerSocket serverSocket = new ServerSocket(12345);
+            System.out.println("Server listening on port 12345...");
+
+            while (true) {
+                // Accept client connection
+                Socket clientSocket = serverSocket.accept();
+                System.out.println("Client connected: " + clientSocket.getInetAddress().getHostAddress());
+
+                // Start a new thread to handle the client connection
+                ClientHandler clientHandler = new ClientHandler(clientSocket, market);
+                clientHandler.start();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    static class ClientHandler extends Thread {
+        private Socket clientSocket;
+        private FarmStore market;
+
+        public ClientHandler(Socket socket, FarmStore market) {
+            this.clientSocket = socket;
+            this.market = market;
+        }
+
+        public void run() {
+            try {
+                // Read data from client
+                BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
+                String request = in.readLine();
+                String[] parsedRequest = request.split(",");
+                System.out.println("Received request from client: " + request);
+
+                // Process request
+                String response = processRequest(parsedRequest[0], Double.parseDouble(parsedRequest[1]), Double.parseDouble(parsedRequest[2]), Double.parseDouble(parsedRequest[3]), Double.parseDouble(parsedRequest[4]));
+                System.out.print("Sending response to client: " + response);
+
+                // Send response to client
+                PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
+                out.println(response);
+
+                // Close connections
+                in.close();
+                out.close();
+                clientSocket.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        private String processRequest(String request, double beef, double pork, double chicken, double eggs) {
+            // Process the request and execute the corresponding method
+            if (request.equals("doTransaction")) {
+                return market.doTransaction(beef, pork, chicken, eggs); // Assuming appropriate arguments for the method
+            } else if (request.equals("doResupply")) {
+                return market.doResupply(beef, pork, chicken, eggs);
+            } else {
+                return "Invalid request!";
+            }
+        }
+    }
+}
-- 
GitLab