Write a psuedocode for the following java code: import java.util.Scanner; public
ID: 3707299 • Letter: W
Question
Write a psuedocode for the following java code:
import java.util.Scanner;
public class InventoryManagement {
public static void main(String[] args) {
String itemName
double quantity
double economicOrderQuantity
double reorderPoint;
public Item(String itemName, double quantity, double economicOrderQuantity, double reorderPoint)
{
itemName = item;
quantity = Q
economicOrderQuantity = EOQ
reorderPoint = ROP;
}
public String getItem() {
return item;
}
public void setItem(String item) {
itemName = item;
}
public double getQuantity() {
return Q;
}
public void setQuantity() {
quantity = Q;
}
public double getEconomicOrderQuantity() {
return EOQ;
}
public void setEconomicOrderQuantity () {
economicOrderQuantity = EOQ;
}
public double getReorderPoint() {
return ROP;
}
public void setReorderPoint () {
reorderPoint = ROP;
}
void display()
{
System.out.println("Item Name = " + item);
System.out.println("Quantity =" + Q);
System.out.println("Economic order quantity =" + EOQ);
System.out.println("Reorder Point=" + ROP);
}
void read()
{
Scanner input = new Scanner(System.in);
System.out.println("Item Name, Quantity, Economic order quantity, and Reorder Point");
item = input.next();
Q = input.nextDouble();
EOQ = input.nextDouble();
ROP = input.nextDouble();
}
}
public class Inventory{
private Item item[];
private double Q;
public Inventory(double quantity)
{
items = new item[quantity];
Q = 0;
}
void additem(item number)
{
If( Q < items)
{items[Q++] = number;
return;
}
System.out.println("Can’t add");
}
void displayall()
{
double buyItem(String itemName, double quantity)
{
for(double inventory=0 ; inventory<Q; inventory++)
if(items[inventory].getItem().equals(itemName))
{
items[inventory].setQuantity(Q+items[inventory].getQuantity());
return Q*items[inventory].EOQ();
}
System.out.println("Decrease");
return 0.0;
}
double sellItem(String itemName, double quantity)
{
for(double inventory=0; inventory< Q; inventory++)
if(items[inventory].getItem().equals(itemName))
if(items[inventory].getQuantity ()>= Q)
{
items[inventory].setQuantity(items[inventory].getQuantity()-Q);
return Q*items[inventory].ROP()*1.1;
}
else
{
System.out.println("not enough inventory");
return 0;
}
System.out.println("Increase");
return 0.0;
}
}
//2.Inputs: mean lead time, mean demand, safety stock, desired service level, stdev of demand, stdev of lead time.
//Outputs: simple reorder point (Simple ROP) or advanced reorder point (Advanced ROP).
Create a Scanner object import java.util.Scanner;
Declare class name CalculateROP{ public class CalculateROP {
create a main method { public static void main(String[] args) {
prompt Scanner object; Scanner input = new Scanner(System.in);
Prompt and initiate the veriables
int SorA = 0;
double simpleLead = 0;
double simpleDemand = 0;
double simpleSS = 0;
double simpleROP = 0;
double advancedLead = 0;
double advancedDemand = 0;
double advancedServiceLevel = 0;
double stdevDemand = 0;
double stdevLead = 0;
double advancedROP = 0;
Prompt a print statment;
prompt a user input and store into a veriable;
if
System.out.println("Please enter 1 for Simple Reorder Point or 2 for Advanced Reorder Point: ");
SorA = input.nextInt();
if (SorA == 1) {
System.out.println("Please enter mean lead time: ");
simpleLead = input.nextInt();
System.out.println("Please enter mean daily demand: ");
simpleDemand = input.nextInt();
System.out.println("Please enter desired safety stock: ");
simpleSS = input.nextInt();
simpleROP = simpleLead * simpleDemand + simpleSS;
System.out.println("Your simple reorder point is " + simpleROP);
}
else if (SorA ==2) {
System.out.println("Please enter mean lead time: ");
advancedLead = input.nextInt();
System.out.println("Please enter mean daily demand: ");
advancedDemand = input.nextInt();
System.out.println("Please enter desired service level in percent: ");
advancedServiceLevel = input.nextInt();
System.out.println("Please enter the standard deviation of lead time: ");
stdevLead = input.nextInt();
System.out.println("Please enter the standard deviation of demand: ");
stdevDemand = input.nextInt();
advancedROP = advancedLead * advancedDemand + ((advancedServiceLevel/100) * Math.sqrt(advancedLead * (stdevDemand * stdevDemand) + ((advancedDemand * advancedDemand) * (stdevLead * stdevLead)) ));
System.out.printf("Your advanced reorder point is %6.2f", advancedROP);
}
else {
System.out.println("Unrecognized Input.");
}
}
}
3. Inputs: annual demand quantity, ordering costs, annual holding cost per unit.
Outputs: economic order quantity (EOQ).
import java.util.Scanner;
public class CalculateEOQ {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double holdingCosts;
double annualDemand;
double orderingCosts;
int EOQ;
System.out.println("Please enter the annual holding costs per unit: ");
holdingCosts = input.nextInt();
System.out.println("Please enter the annual demand quantity: ");
annualDemand = input.nextInt();
System.out.println("Please enter the ordering cost: ");
orderingCosts = input.nextInt();
EOQ = (int) Math.sqrt((annualDemand*orderingCosts)/holdingCosts);
System.out.printf("Your economic order quantity is %d", EOQ);
}
}
Explanation / Answer
1.
Main Class
declare itemName type string;
declare quantity type double;
declare economicOrderQuantity type double;
declare reorderPoint type double;
use itemName as item
use quantity as Q
use economicOrderQuantity as EOQ
use reorderPoint as ROP
Read the value of item using getItem()
assign item to itemName;
Read the value of Q using getQuantity()
assign Q to Quantity;
Read the value of EOQ using getEconomicOrderQuantity()
assign EOQ to getEconomicOrderQuantity;
Read the value of ROP using getReorderPoint()
assign ROP to getReorderPoint;
Using Display method
Print item
Print Q
Print EOQ
Print ROP
Using Read method
Input the value of item,Q,EOQ,ROP using scanner class
Input the item;
Input the Q;
Input the EOQ;
Input the ROP;
class Inventory
declare item array of type Item
declare Q of type double
constructor method
Number of items
initialize q to zero
additem method
if q is less than items
items[Q++] = number;
else
can't add
displayall method
buyItem method(parameters itemName and quantity) return double
for inventory=0 to inventory<Q
if items[inventory].getItem().equals(itemName)
then
items[inventory].setQuantity(Q+items[inventory].getQuantity());
return Q*items[inventory].EOQ();
print "decrease"
return 0.0
sellItem method(parameters itemName and quantity) return double
for inventory=0 to inventory<Q
if items[inventory].getItem().equals(itemName)
then
if items[inventory].getQuantity ()>= Q
then
items[inventory].setQuantity(items[inventory].getQuantity()-Q);
return Q*items[inventory].ROP()*1.1;
else
print "not enough inventory
return 0;
print "Increase"
return 0.0
==========================================================
2.
import the class that reads runtime values //Scanner class
Use the scanner object to read input values
initiate SorA to 0
initiate simpleLead to 0
initiate simpleDemand to 0
initiate simpleSS to 0
initiate simpleROP to 0
initiate advancedLead to 0
initiate advancedDemand to 0
initiate advancedServiceLevel to 0
initiate stdevDemand to 0
initiate stdevLead to 0
initiate advancedROP to 0
initiate simpleSS to 0
Prompt a statement "Please enter 1 for Simple Reorder Point or 2 for Advanced Reorder Point:"
Input the SorA;
if the SorA is equals to one
input the simpleLead;
input the simpleDemand;
input the simpleSS;
calculate (simpleLead * simpleDemand + simpleSS) and assign to simpleROP;
print simpleROP;
if the SorA is equals to two
input the advancedLead;
input the advancedDemand;
input the advancedServiceLevel;
input the stdevLead;
input the stdevDemand;
calculate advancedLead * advancedDemand + ((advancedServiceLevel/100) * Math.sqrt(advancedLead * (stdevDemand * stdevDemand) + ((advancedDemand * advancedDemand) * (stdevLead * stdevLead)) ))
assign calculated value to advancedROP;
print advancedROP;
else
print "Unrecognized Input".
========================================================
3.
import the class that reads runtime values //Scanner class
Use the scanner object to read input values
declare variables holdingCosts,annualDemand,orderingCosts,EOQ;
Input the holdingCosts;
Input the annualDemand;
Input the orderingCosts;
Calculate EOQ = square root of ((annualDemand*orderingCosts)/holdingCosts);
Convert EOQ value to integer;
print the economic order quantity (EOQ)
=======================================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.