Stock process program I have the following program and it's working as I had hoped but now I would like to tidy up the code, putting bits into new methods, so I'm not left with loads of code in the main method. I'm new to Java, so don't know how to go about this.

I have the following methods:

    public String getInventoryCode()
{
    return inventoryCode;
}

  public int getQuantityInStock()
{
    return quantityInStock;
}

public int getDailyDemand()
{
    return dailyDemand;
}

  public int getReOrder()
{
    return reOrder;
}

public int getLeadTime()  
{  
    return leadTime;
}

*/ Would like to use these */

*/ Would like to use instead of quantityIn -= item_1.getDailyDemand() in main method */

public void removeDailyDemand(){

    quantityInStock -= dailyDemand;
}

*/ Would like to use instead of quantityIn &lt; reOrderThreshold  */

public void newDeliveryIn(){
    ; 
}    

*/ Would like to use instead of quantityIn += item_1.getReOrder() in main method */

public void isReOrderPoint(){
    ; 
}


The bottom three methods I have made as I want to use them but I'm not exactly sure how, so they aren't currently doing anything, I have got all the rest to function as I had hoped.

Here is the main code:

/* Create new item - Inventory Code, Starting Quantity In Stock, Daily Demand, Re-order Amount, Time in Transit (Lead-time) */ 

    StockItem item_1 = new StockItem("A654Y", 1000, 50, 500, 5);

    /* Column titles */

            System.out.println("Day" + "\t" + "Stock" + "\t" + "Order Status");
            System.out.println("");

            /*Variables */

    int reOrderThreshold = 600;
    int orderTravelTime = 0;
    boolean orderInTravel = false;
    int quantityIn = item_1.getQuantityInStock();

    /* For loop to count 50 days */

    for (int n = 1; n &lt;= 50; n++) {
        String out = "";

        /* Remove daily demand from current stock */
        quantityIn -= item_1.getDailyDemand();

        out += n;
        out += " " + "\t" + quantityIn + "\t";

        /* If order has been ordered and has not arrived */

        if (orderInTravel &amp;&amp; orderTravelTime &lt; item_1.getLeadTime()) { 

            orderTravelTime++;

                            out += "In Transit -" + "\t";

        /* If ordered and has arrived */

        } else if (orderInTravel &amp;&amp; orderTravelTime &gt;= item_1.getLeadTime()) { 
            orderTravelTime = 0;
            orderInTravel = false;

                            quantityIn += item_1.getReOrder();
                            out += "New Stock Delivered (" + item_1.getReOrder()")   and Will be Added to Quantity in Stock the Next Day";

        }
                    /* If stock gets too low, order */

        if (quantityIn &lt; reOrderThreshold) { 
            orderInTravel = true;

            out += "Ordered";
        }

                    /* Print out results */

        System.out.println(out);
    }


Here is part of the output:




Day   Stock   Order Status

1     950 
2     900 
3     850 
4     800 
5     750 
6     700 
7     650 
8     600 
9     550 Ordered
10    500 In Transit -    Ordered
11    450 In Transit -    Ordered
12    400 In Transit -    Ordered
13    350 In Transit -    Ordered
14    300 In Transit -    Ordered
15    250 New Stock Delivered (500) and Will be Added to Quantity in Stock the Next Day
16    700 
17    650 
18    600 
19    550 Ordered
20    500 In Transit -    Ordered
21    450 In Transit -    Ordered
...
The first thing I should say is that your code looks very messy and requires &quot;cleaning up&quot;. I don't know for sure if this is because of formatting problems when transferring from IDE to Code Review, but if it is not, then formatting needs work.
After formatting, it looks like this:
public class Test {

    public static void main(String[] args) {
        StockItem item_1 = new StockItem(&quot;A654Y&quot;, 1000, 50, 500, 5);
        System.out.println(&quot;Day&quot; + &quot;\t&quot; + &quot;Stock&quot; + &quot;\t&quot; + &quot;Order Status&quot;);
        System.out.println();
        int reOrderThreshold = 600;
        int orderTravelTime = 0;
        boolean orderInTravel = false;
        int quantityIn = item_1.getQuantityInStock();
        for (int n = 1; n &lt;= 50; n++) {
            String out = &quot;&quot;;
            quantityIn -= item_1.getDailyDemand();
            out += n;
            out += &quot; &quot; + &quot;\t&quot; + quantityIn + &quot;\t&quot;;
            if (orderInTravel &amp;&amp; orderTravelTime &lt; item_1.getLeadTime()) {
                orderTravelTime++;
                out += &quot;In Transit -&quot; + &quot;\t&quot;;
            } else if (orderInTravel &amp;&amp; orderTravelTime &gt;= item_1.getLeadTime()) {
                orderTravelTime = 0;
                orderInTravel = false;
                quantityIn += item_1.getReOrder();
                out += &quot;New Stock Delivered (&quot;
                        + item_1.getReOrder()
                        + &quot;)   and Will be Added to Quantity in Stock the Next Day&quot;;
            }
            if (quantityIn &lt; reOrderThreshold) {
                orderInTravel = true;
                out += &quot;Ordered&quot;;
            }
            System.out.println(out);
        }
    }
}

class StockItem {

    String inventoryCode;
    int quantityInStock;
    int dailyDemand;
    int reOrder;
    int leadTime;

    public StockItem(String inventoryCode, int quantityInStock,
            int dailyDemand, int reOrder, int leadTime) {
        this.inventoryCode = inventoryCode;
        this.quantityInStock = quantityInStock;
        this.dailyDemand = dailyDemand;
        this.reOrder = reOrder;
        this.leadTime = leadTime;
    }

    public String getInventoryCode() {
        return inventoryCode;
    }

    public int getQuantityInStock() {
        return quantityInStock;
    }

    public int getDailyDemand() {
        return dailyDemand;
    }

    public int getReOrder() {
        return reOrder;
    }

    public int getLeadTime() {
        return leadTime;
    }

}

Note that this is not the final result. There are a lot more to add before it's good.
Now to the actual code...
First of all...
In the main method, there is this:
System.out.println(&quot;Day&quot; + &quot;\t&quot; + &quot;Stock&quot; + &quot;\t&quot; + &quot;Order Status&quot;);
System.out.println();

This could be easily changed to:
System.out.println(&quot;Day\tStock\tOrder Status\n&quot;);

This improves efficiency by reducing the time required to concatenate the Strings, as well as removing the requirement of the empty System.out.println(). In fact, you split the Strings where no split is necessary. &quot; &quot; + &quot;\t&quot; can just simply be &quot; \t&quot;.
String out = &quot;&quot;;

Remember that Strings are immutable. Since out is concatenated multiple times, you should use StringBuilder, and add Strings with out.append(...).
All the code in the for loop can be at least broken down into two methods. But before we do that, the variables should be instantiated outside of main, with static.
static StockItem item_1 = new StockItem(&quot;A654Y&quot;, 1000, 50, 500, 5);
static int reOrderThreshold = 600;
static int orderTravelTime = 0;
static boolean orderInTravel = false;
static int quantityIn = item_1.getQuantityInStock();

Then, let's break it away from the main method:
public static void main(String[] args) {
    System.out.println(&quot;Day\tStock\tOrder Status\n&quot;);
    for (int n = 1; n &lt;= 50; n++) {
        doDay(n);
    }
}

private static void doDay(int day) {
    StringBuilder out = new StringBuilder();
    quantityIn -= item_1.getDailyDemand();
    out.append(day).append(&quot; \t&quot;).append(quantityIn).append(&quot;\t&quot;);
    if (orderInTravel &amp;&amp; orderTravelTime &lt; item_1.getLeadTime()) {
        orderTravelTime++;
        out.append(&quot;In Transit -\t&quot;);
    } else if (orderInTravel &amp;&amp; orderTravelTime &gt;= item_1.getLeadTime()) {
        orderTravelTime = 0;
        orderInTravel = false;
        quantityIn += item_1.getReOrder();
        out.append(&quot;New Stock Delivered (&quot;).append(item_1.getReOrder()).append(&quot;)   and Will be Added to Quantity in Stock the Next Day&quot;);
    }
    if (quantityIn &lt; reOrderThreshold) {
        orderInTravel = true;
        out.append(&quot;Ordered&quot;);
    }
    System.out.println(out);
}

And then draw out the if statements:
private static void doDay(int day) {
    StringBuilder out = new StringBuilder();
    quantityIn -= item_1.getDailyDemand();
    out.append(day).append(&quot; \t&quot;).append(quantityIn).append(&quot;\t&quot;);
    checkOrder(out);
    checkStock(out);
    System.out.println(out);
}

private static void checkOrder(StringBuilder output) {
    if (orderInTravel &amp;&amp; orderTravelTime &lt; item_1.getLeadTime()) {
        orderTravelTime++;
        output.append(&quot;In Transit -\t&quot;);
    } else if (orderInTravel &amp;&amp; orderTravelTime &gt;= item_1.getLeadTime()) {
        orderTravelTime = 0;
        orderInTravel = false;
        quantityIn += item_1.getReOrder();
        output.append(&quot;New Stock Delivered (&quot;).append(item_1.getReOrder()).append(&quot;)   and Will be Added to Quantity in Stock the Next Day&quot;);
    }
}

private static void checkStock(StringBuilder output) {
    if (quantityIn &lt; reOrderThreshold) {
        orderInTravel = true;
        output.append(&quot;Ordered&quot;);
    }
}

And there you go, small methods!
As for the extra methods, I think they are unnecessary.
Final code:
public class Main {

    static StockItem item_1 = new StockItem(&quot;A654Y&quot;, 1000, 50, 500, 5);
    static int reOrderThreshold = 600;
    static int orderTravelTime = 0;
    static boolean orderInTravel = false;
    static int quantityIn = item_1.getQuantityInStock();

    public static void main(String[] args) {
        System.out.println(&quot;Day\tStock\tOrder Status\n&quot;);
        for (int n = 1; n &lt;= 50; n++) {
            doDay(n);
        }
    }

    private static void doDay(int day) {
        StringBuilder out = new StringBuilder();
        quantityIn -= item_1.getDailyDemand();
        out.append(day).append(&quot; \t&quot;).append(quantityIn).append(&quot;\t&quot;);
        checkOrder(out);
        checkStock(out);
        System.out.println(out);
    }

    private static void checkOrder(StringBuilder output) {
        if (orderInTravel &amp;&amp; orderTravelTime &lt; item_1.getLeadTime()) {
            orderTravelTime++;
            output.append(&quot;In Transit -\t&quot;);
        } else if (orderInTravel &amp;&amp; orderTravelTime &gt;= item_1.getLeadTime()) {
            orderTravelTime = 0;
            orderInTravel = false;
            quantityIn += item_1.getReOrder();
            output.append(&quot;New Stock Delivered (&quot;)
                    .append(item_1.getReOrder())
                    .append(&quot;)   and Will be Added to Quantity in Stock the Next Day&quot;);
        }
    }

    private static void checkStock(StringBuilder output) {
        if (quantityIn &lt; reOrderThreshold) {
            orderInTravel = true;
            output.append(&quot;Ordered&quot;);
        }
    }

}

class StockItem {

    String inventoryCode;
    int quantityInStock;
    int dailyDemand;
    int reOrder;
    int leadTime;

    public StockItem(String inventoryCode, int quantityInStock,
            int dailyDemand, int reOrder, int leadTime) {
        this.inventoryCode = inventoryCode;
        this.quantityInStock = quantityInStock;
        this.dailyDemand = dailyDemand;
        this.reOrder = reOrder;
        this.leadTime = leadTime;
    }

    public String getInventoryCode() {
        return inventoryCode;
    }

    public int getQuantityInStock() {
        return quantityInStock;
    }

    public int getDailyDemand() {
        return dailyDemand;
    }

    public int getReOrder() {
        return reOrder;
    }

    public int getLeadTime() {
        return leadTime;
    }

}