src/Recipe.java
/**
     * Logic behind recalculating an existing recipe's values.
     * - ArrayList<String> fileText = the recipe's text read by the FileReader.
     * - int newAmount = the new amount of people to calculate for.
     */
Logic behind recalculating an existing recipe's values.
- ArrayList fileText = the recipe's text read by the FileReader.
- int newAmount = the new amount of people to calculate for.
Logic behind recalculating an existing recipe ' s values . - ArrayList fileText = the recipe ' s text read by the FileReader . - int newAmount = the new amount of people to calculate for .
public static void calculateNewValues(int newAmount, ArrayList < String > fileText) {
        ArrayList < String > ingredientNames = new ArrayList < > ();
        ArrayList < Double > ingredientAmounts = new ArrayList < > ();
        ArrayList < String > ingredientUnits = new ArrayList < > ();
        int people = Integer.valueOf(fileText.get(fileText.size() - 1));
        boolean readName = true, readAmount = false, readUnit = false;
        for (int i = 1; i < (fileText.size() - 1); i++) {
            if (readName) {
                ingredientNames.add(fileText.get(i));
                readName = false;
                readAmount = true;
                continue;
            }
            if (readAmount) {
                ingredientAmounts.add(Double.valueOf(fileText.get(i)));
                readAmount = false;
                readUnit = true;
                continue;
            }
            if (readUnit) {
                ingredientUnits.add(fileText.get(i));
                readUnit = false;
                readName = true;
                continue;
            }
        }
        /**
         * Pseudocode:
         * 
         * Calculate each ingredient's amount for 1 person...
         * Then, multiply to determine the amount of each ingredient to serve the new amount of people.
         * 
         * (ingredient amount / no. of people) * new amount of people
         */
        ArrayList < Double > newAmounts = new ArrayList < > ();
        for (int i = 0; i < ingredientAmounts.size(); i++) {
            newAmounts.add(((ingredientAmounts.get(i) / people) * newAmount));
        }
        sleep(1);
        System.out.println("\n[Modify]: Recalculated values for '" + newAmount + "' people.\n");
        for (int i = 0; i < ingredientNames.size(); i++) {
            System.out.println("[Modify] Ingredient: " + ingredientNames.get(i) + ", New Amount: " + newAmounts.get(i) + " " + ingredientUnits.get(i));
            sleep(2);
        }
    }
public static void calculateNewValues ( int newAmount , ArrayList < String > fileText ) { ArrayList < String > ingredientNames = new ArrayList < > ( ) ; ArrayList < Double > ingredientAmounts = new ArrayList < > ( ) ; ArrayList < String > ingredientUnits = new ArrayList < > ( ) ; int people = Integer . valueOf ( fileText . get ( fileText . size ( ) - 1 ) ) ; boolean readName = true , readAmount = false , readUnit = false ; for ( int i = 1 ; i < ( fileText . size ( ) - 1 ) ; i ++ ) { if ( readName ) { ingredientNames . add ( fileText . get ( i ) ) ; readName = false ; readAmount = true ; continue ; } if ( readAmount ) { ingredientAmounts . add ( Double . valueOf ( fileText . get ( i ) ) ) ; readAmount = false ; readUnit = true ; continue ; } if ( readUnit ) { ingredientUnits . add ( fileText . get ( i ) ) ; readUnit = false ; readName = true ; continue ; } } /**
         * Pseudocode:
         * 
         * Calculate each ingredient's amount for 1 person...
         * Then, multiply to determine the amount of each ingredient to serve the new amount of people.
         * 
         * (ingredient amount / no. of people) * new amount of people
         */ ArrayList < Double > newAmounts = new ArrayList < > ( ) ; for ( int i = 0 ; i < ingredientAmounts . size ( ) ; i ++ ) { newAmounts . add ( ( ( ingredientAmounts . get ( i ) / people ) * newAmount ) ) ; } sleep ( 1 ) ; System . out . println ( "\n[Modify]: Recalculated values for '" + newAmount + "' people.\n" ) ; for ( int i = 0 ; i < ingredientNames . size ( ) ; i ++ ) { System . out . println ( "[Modify] Ingredient: " + ingredientNames . get ( i ) + ", New Amount: " + newAmounts . get ( i ) + " " + ingredientUnits . get ( i ) ) ; sleep ( 2 ) ; } }
Logic behind recalculating an existing recipe's values.
Logic behind recalculating an existing recipe ' s values .
//will read ingredient id (e.g. IngredientOnE)
 // will read ingredient id's amount
 //  will read ingredient id's unit
