Skip to content
Snippets Groups Projects
Commit 1d40a5db authored by Brutzman, Don's avatar Brutzman, Don
Browse files

javadoc

parent 223755a8
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,12 @@ package MV3500Cohort2023MarchJune.projects.Islas; ...@@ -7,7 +7,12 @@ package MV3500Cohort2023MarchJune.projects.Islas;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
/** Model */
public class Client_Farm { public class Client_Farm {
/** Command line interface invocation
* @param args arguments
*/
public static void main(String[] args) { public static void main(String[] args) {
// TODO - Fill out the following questionairre: // TODO - Fill out the following questionairre:
......
...@@ -8,12 +8,15 @@ import simkit.SimEntityBase; ...@@ -8,12 +8,15 @@ import simkit.SimEntityBase;
import simkit.random.RandomVariate; import simkit.random.RandomVariate;
import simkit.random.RandomVariateFactory; import simkit.random.RandomVariateFactory;
/** Model */
public class Customer extends SimEntityBase{ public class Customer extends SimEntityBase{
private RandomVariate beefPreference; private RandomVariate beefPreference;
private RandomVariate porkPreference; private RandomVariate porkPreference;
private RandomVariate chickenPreference; private RandomVariate chickenPreference;
private RandomVariate eggsPreference; private RandomVariate eggsPreference;
/** Constructor */
public Customer(double averagePurchaseOfBeef, double beefPlusMinus, double averagePurchaseOfPork, double porkPlusMinus, double averagePurchaseOfChicken, double chickenPlusMinus, double averagePurchaseOfEggs, double eggsPlusMinus) { 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.beefPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfBeef, beefPlusMinus);
this.porkPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfPork, porkPlusMinus); this.porkPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfPork, porkPlusMinus);
...@@ -21,10 +24,12 @@ public class Customer extends SimEntityBase{ ...@@ -21,10 +24,12 @@ public class Customer extends SimEntityBase{
this.eggsPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfEggs, eggsPlusMinus); this.eggsPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfEggs, eggsPlusMinus);
} }
/** commence simulation run */
public void doRun() { public void doRun() {
waitDelay("Transaction", 0.0); waitDelay("Transaction", 0.0);
} }
/** perform transaction */
public void doTransaction() { public void doTransaction() {
double beef = beefPreference.generate(); double beef = beefPreference.generate();
beef = beef < 0 ? 0 : beef; beef = beef < 0 ? 0 : beef;
...@@ -42,18 +47,26 @@ public class Customer extends SimEntityBase{ ...@@ -42,18 +47,26 @@ public class Customer extends SimEntityBase{
waitDelay("Transaction", 7.0); waitDelay("Transaction", 7.0);
} }
/** accessor
* @return preference RandomVariate */
public RandomVariate getBeefPreference() { public RandomVariate getBeefPreference() {
return beefPreference; return beefPreference;
} }
/** accessor
* @return preference RandomVariate */
public RandomVariate getPorkPreference() { public RandomVariate getPorkPreference() {
return porkPreference; return porkPreference;
} }
/** accessor
* @return preference RandomVariate */
public RandomVariate getChickenPreference() { public RandomVariate getChickenPreference() {
return chickenPreference; return chickenPreference;
} }
/** accessor
* @return preference RandomVariate */
public RandomVariate getEggsPreference() { public RandomVariate getEggsPreference() {
return eggsPreference; return eggsPreference;
} }
......
...@@ -6,6 +6,7 @@ package MV3500Cohort2023MarchJune.projects.Islas; ...@@ -6,6 +6,7 @@ package MV3500Cohort2023MarchJune.projects.Islas;
import java.text.DecimalFormat; import java.text.DecimalFormat;
/** Model */
public class FarmStore { public class FarmStore {
private double bankAccount; private double bankAccount;
private double BEEFCOST = 10; // Cost per pound private double BEEFCOST = 10; // Cost per pound
...@@ -18,6 +19,7 @@ public class FarmStore { ...@@ -18,6 +19,7 @@ public class FarmStore {
protected double chickenQuantity; // Quantity in pounds protected double chickenQuantity; // Quantity in pounds
protected double eggQuantity; // Quantity in dozens protected double eggQuantity; // Quantity in dozens
/** Constructor */
public FarmStore() { public FarmStore() {
this.bankAccount = 0; this.bankAccount = 0;
this.beefQuantity = 0; this.beefQuantity = 0;
...@@ -26,6 +28,12 @@ public class FarmStore { ...@@ -26,6 +28,12 @@ public class FarmStore {
this.eggQuantity = 0; this.eggQuantity = 0;
} }
/** perform transaction
* @param beef additions
* @param pork additions
* @param chicken additions
* @param eggs additions
* @return receipt message */
public String doTransaction(double beef, double pork, double chicken, double eggs) { public String doTransaction(double beef, double pork, double chicken, double eggs) {
DecimalFormat df = new DecimalFormat("#.##"); DecimalFormat df = new DecimalFormat("#.##");
...@@ -62,6 +70,12 @@ public class FarmStore { ...@@ -62,6 +70,12 @@ public class FarmStore {
return "Product purchased:\nBeef: " + beef + " lbs\nPork: " + pork + " lbs\nChicken: " + chicken + " lbs\nEggs: " + eggs + " dozen\nTransaction total: $" + cost; return "Product purchased:\nBeef: " + beef + " lbs\nPork: " + pork + " lbs\nChicken: " + chicken + " lbs\nEggs: " + eggs + " dozen\nTransaction total: $" + cost;
} }
/** Simulation step
* @param beef additions
* @param pork additions
* @param chicken additions
* @param eggs additions
* @return receipt message */
public String doResupply(double beef, double pork, double chicken, double eggs) { public String doResupply(double beef, double pork, double chicken, double eggs) {
this.beefQuantity += beef; this.beefQuantity += beef;
this.porkQuantity += pork; this.porkQuantity += pork;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
package MV3500Cohort2023MarchJune.projects.Islas; package MV3500Cohort2023MarchJune.projects.Islas;
/** Model of interest */
public class LivestockRanch { public class LivestockRanch {
private int totalCattle; private int totalCattle;
private int totalPigs; private int totalPigs;
...@@ -15,6 +16,7 @@ public class LivestockRanch { ...@@ -15,6 +16,7 @@ public class LivestockRanch {
private double chickenProcessRate; private double chickenProcessRate;
private double eggLayingRate; private double eggLayingRate;
/** Constructor */
public LivestockRanch (int totalCattle, int totalPigs, int totalBroilerChickens, int totalLayerChickens) { public LivestockRanch (int totalCattle, int totalPigs, int totalBroilerChickens, int totalLayerChickens) {
this.totalCattle = totalCattle; this.totalCattle = totalCattle;
this.totalPigs = totalPigs; this.totalPigs = totalPigs;
...@@ -27,34 +29,42 @@ public class LivestockRanch { ...@@ -27,34 +29,42 @@ public class LivestockRanch {
this.eggLayingRate = totalLayerChickens * (25 / 12); // 25 eggs per layer chicken (divided by 12 to be sold in dozens) this.eggLayingRate = totalLayerChickens * (25 / 12); // 25 eggs per layer chicken (divided by 12 to be sold in dozens)
} }
/** accessor */
public int getTotalCattle() { public int getTotalCattle() {
return totalCattle; return totalCattle;
} }
/** accessor */
public int getTotalPigs() { public int getTotalPigs() {
return totalPigs; return totalPigs;
} }
/** accessor */
public int getTotalBroilerChickens() { public int getTotalBroilerChickens() {
return totalBroilerChickens; return totalBroilerChickens;
} }
/** accessor */
public int getTotalLayerChickens() { public int getTotalLayerChickens() {
return totalLayerChickens; return totalLayerChickens;
} }
/** Javadoc goes here */
public double getCattleProcessRate() { public double getCattleProcessRate() {
return cattleProcessRate; return cattleProcessRate;
} }
/** accessor */
public double getPigProcessRate() { public double getPigProcessRate() {
return pigProcessRate; return pigProcessRate;
} }
/** accessor */
public double getChickenProcessRate() { public double getChickenProcessRate() {
return chickenProcessRate; return chickenProcessRate;
} }
/** accessor */
public double getEggLayingRate() { public double getEggLayingRate() {
return eggLayingRate; return eggLayingRate;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment