Professional Documents
Culture Documents
*/
import java.io.*;
void read_data (double ic, double oc, double uc, double dr) {
this.ic = ic; // Inventory carrying charge
this.oc = oc; // Ordering cost
this.uc = uc; // Unit cost
this.dr = dr; // Demand rate
}
void read_data(double ic, double oc, double uc, double dr, double sc) {
super.read_data(ic, oc, uc, dr); // call the super class method
this.sc = sc; // shortages cost
}
x = Math.sqrt((IC + sc)/(sc));
return Q*x;
}
}
void read_data(double ic, double oc, double uc, double dr, double sr) {
super.read_data(ic, oc, uc, dr); // call the super class method
this.sr = sr; // supply rate
}
void read_data(double ic, double oc, double uc, double dr, double sc, double
sr) {
super.read_data(ic, oc, uc, dr, sc); // call the super class method
this.sr = sr; // supply rate
}
class Inventory {
static double inventory_charge , ordering_cost , unit_cost , demand_rate ,
shortage_cost , supply_rate;
/* constructor function which gets the various parameters as input from the user
*/
Inventory() throws IOException {
System.out.println("\tPlease enter the folowing: \n");
/* string NAMES contains the names of the options available with a space of
7 alloted to each option */
final String NAMES = "Model 1Model 2Model 3Model 4";
System.out.println("\n\n");
System.out.println("\t\t\tEconomic Order Quantity");
System.out.println("\t\t\t***********************\n\n");
System.out.println("\t--------------------------------------------------\n");
System.out.println("\tModel 1: EOQ with no shortages
-> Press 1");
System.out.println("\tModel 2: EOQ with planned shortages
-> Press 2");
System.out.println("\tModel 3: EOQ with finite replenishment, no shortages
-> Press 3");
System.out.println("\tModel 4: EOQ with finite replenishment, planned
shortages-> Press 4");
System.out.println("");
System.out.println("\tQuit
-> Press Q");
do {
System.out.print("\n\tPlease enter your choice (1/2/3/4/Q): ");
switch(y) {
case 0: Model_1 m1 = new Model_1();
m1.read_data(inventory_charge, ordering_cost, unit_cost,
demand_rate);
m1.show_parameters();
System.out.println("\n\tEOQ = " + m1.compute());
break;
}
}
/*
OUTPUT
The supply rate can not be less than the demand rate.
Please re-enter the values:
Demand Rate (units per year) : 150
Supply(Production) Rate (units per year) : 200
Model 1
-------
Inventory carrying charge (fraction of Re. per unit per year): 0.2
Ordering Cost (Rs per order) : 50.0
Unit Cost (Rs per unit) : 60.0
Demand Rate (units per year) : 150.0
EOQ = 35.35533905932738
Model 2
-------
Inventory carrying charge (fraction of Re. per unit per year): 0.2
Ordering Cost (Rs per order) : 50.0
Unit Cost (Rs per unit) : 60.0
Demand Rate (units per year) : 150.0
Shortages Cost (Rs. per unit per year) : 150.0
EOQ = 36.742346141747674
Model 3
-------
Inventory carrying charge (fraction of Re. per unit per year): 0.2
Ordering Cost (Rs per order) : 50.0
Unit Cost (Rs per unit) : 60.0
Demand Rate (units per year) : 150.0
Supply(Production) Rate (units per year) : 200.0
EOQ = 70.71067811865476
Model 4
-------
Inventory carrying charge (fraction of Re. per unit per year): 0.2
Ordering Cost (Rs per order) : 50.0
Unit Cost (Rs per unit) : 60.0
Demand Rate (units per year) : 150.0
Shortages Cost (Rs. per unit per year) : 150.0
Supply(Production) Rate (units per year) : 200.0
EOQ = 73.48469228349535