src/Recipe.java
/**
     * Handles the modification process (recalculation)
     */
Handles the modification process (recalculation)
Handles the modification process ( recalculation )
public static void handleModify() {
        /**
         * Program reads the LOCALLY saved file - and stores it in a list.
         */
        ArrayList < String > text = new ArrayList < > (readFile());
        /* Structure (Method Planning):
         * 
         * Local Save Structure:
         * - Recipe Name
         * - Ingredient one
         * 		- Ingredient one amount
         *		- Ingredient one unit
         * - People served
         */
        sleep(1);
        System.out.println("[Modify]: Modifying recipe: " + text.get(0));
        sleep(1);
        System.out.println("[Modify]: Please enter the NEW value for the number of people you will be serving. (Existing value: " + text.get((text.size() - 1)) + " people)");
        String value = sc.nextLine();
        int newPeople = 0;
        if (validateInput(value)) {
            newPeople = Integer.valueOf(value);
        } else {
            System.out.println("Please enter an integer value for the number of people to recalculate for.");
            handleModify();
        }
        System.out.println("[Modify]: Calculating...");
        sleep(3);
        calculateNewValues(newPeople, text);
    }
public static void handleModify ( ) { /**
         * Program reads the LOCALLY saved file - and stores it in a list.
         */ ArrayList < String > text = new ArrayList < > ( readFile ( ) ) ; /* Structure (Method Planning):
         * 
         * Local Save Structure:
         * - Recipe Name
         * - Ingredient one
         * 		- Ingredient one amount
         *		- Ingredient one unit
         * - People served
         */ sleep ( 1 ) ; System . out . println ( "[Modify]: Modifying recipe: " + text . get ( 0 ) ) ; sleep ( 1 ) ; System . out . println ( "[Modify]: Please enter the NEW value for the number of people you will be serving. (Existing value: " + text . get ( ( text . size ( ) - 1 ) ) + " people)" ) ; String value = sc . nextLine ( ) ; int newPeople = 0 ; if ( validateInput ( value ) ) { newPeople = Integer . valueOf ( value ) ; } else { System . out . println ( "Please enter an integer value for the number of people to recalculate for." ) ; handleModify ( ) ; } System . out . println ( "[Modify]: Calculating..." ) ; sleep ( 3 ) ; calculateNewValues ( newPeople , text ) ; }
Handles the modification process (recalculation)
Handles the modification process ( recalculation )
//newPeople and text are both parsed into the calculateNewValues() method.
