src/Controller/AddProductController.java
/**
     * * Save Button Handler verifies that there are no empty fields, incorrect
     * values, or incompatible data types present. If any of the above are
     * present then an exception is thrown and logged. If there are no
     * exceptions to handle then the product will be saved and added to
     * inventory.
     *
     * @param event
     */
Save Button Handler verifies that there are no empty fields, incorrect
values, or incompatible data types present. If any of the above are
present then an exception is thrown and logged. If there are no
exceptions to handle then the product will be saved and added to
inventory.

@param event
Save Button Handler verifies that there are no empty fields incorrect values or incompatible data types present . If any of the above are present then an exception is thrown and logged . If there are no exceptions to handle then the product will be saved and added to inventory . @param event
@FXML
    private void saveBtnHandler(ActionEvent event) throws IOException {
        String productName = productNameField.getText();
        String productPrice = priceField.getText();
        String productStockLevel = inventoryLevelField.getText();
        String productMinStockLevel = minLevelField.getText();
        String productMaxStockLevel = maxLevelField.getText();
        productFieldException = Product.productFieldExceptions(
                productName,
                productPrice,
                productStockLevel,
                productMinStockLevel,
                productMaxStockLevel,
                productFieldException);
        productDataTypeException = Product.prodDataTypeExceptions(
                productPrice,
                productStockLevel,
                productMinStockLevel,
                productMaxStockLevel,
                productDataTypeException);
        productValueException = Product.productValueExceptions(
                Double.parseDouble(productPrice),
                Integer.parseInt(productStockLevel),
                Integer.parseInt(productMinStockLevel),
                Integer.parseInt(productMaxStockLevel),
                productValueException);
        if (productFieldException.length() > 0) {
            System.err.println("Empty fields present. Product not added to inventory.");
            Alert emptyFields = new Alert(Alert.AlertType.WARNING);
            emptyFields.setTitle("ERROR: EMPTY FIELDS PRESENT");
            emptyFields.setHeaderText("This product has not been added to inventory");
            emptyFields.setContentText(productFieldException);
            emptyFields.showAndWait();
            productFieldException = "";
        } else if (productDataTypeException.length() > 0) {
            System.err.println("Invalid data types present. Product not added to inventory.");
            Alert invalidDataTypes = new Alert(Alert.AlertType.WARNING);
            invalidDataTypes.setTitle("ERROR: INVALID DATA TYPES PRESENT");
            invalidDataTypes.setHeaderText("This product has not been added to inventory");
            invalidDataTypes.setContentText(productDataTypeException);
            invalidDataTypes.showAndWait();
            productDataTypeException = "";
        } else if (productValueException.length() > 0) {
            System.err.println("Invalid field values present. Product has not been added to inventory.");
            Alert invalidValues = new Alert(Alert.AlertType.WARNING);
            invalidValues.setTitle("ERROR: INVALID VALUES PRESENT");
            invalidValues.setHeaderText("This product has not been added to inventory");
            invalidValues.setContentText(productValueException);
            invalidValues.showAndWait();
            productValueException = "";
        } else {
            try {
                if (associatedParts.isEmpty()) {
                    System.err.println("No parts added to product. Product has not been added to inventory.");
                    Alert noPartsAdded = new Alert(Alert.AlertType.WARNING);
                    noPartsAdded.setTitle("ERROR: NO PARTS ADDED TO PRODUCT");
                    noPartsAdded.setHeaderText("This product has not been added to inventory");
                    noPartsAdded.setContentText("A new product must contain at least one part.");
                    noPartsAdded.showAndWait();
                } else {
                    Product newProduct = new Product();
                    newProduct.setId(productID);
                    newProduct.setName(productName);
                    newProduct.setPrice(Double.parseDouble(productPrice));
                    newProduct.setStock(Integer.parseInt(productStockLevel));
                    newProduct.setMax(Integer.parseInt(productMaxStockLevel));
                    newProduct.setMin(Integer.parseInt(productMinStockLevel));
                    newProduct.setAssociatedParts(associatedParts);
                    Inventory.addProduct(newProduct);
                    System.out.println("Product " + productName + " (ID#: " + productID + ") successfully added to inventory.");
                    Alert productAddSuccess = new Alert(Alert.AlertType.INFORMATION);
                    productAddSuccess.setTitle("SUCCESS: PRODUCT ADDED");
                    productAddSuccess.setHeaderText(productName + " Successfully Added to Inventory");
                    productAddSuccess.setContentText("Click OK to return to the main screen.");
                    productAddSuccess.showAndWait();
                    if (productAddSuccess.getResult() == ButtonType.OK) {
                        System.out.println("User confirmed product addition.\nExiting to Main Screen.");
                        Parent root = FXMLLoader.load(getClass().getResource("/View/MainScreen.fxml"));
                        Scene mainScreen = new Scene(root);
                        Stage mainScreenWindow = (Stage) ((Node) event.getSource()).getScene().getWindow();
                        mainScreenWindow.setTitle("ABC Company: Inventory Management System");
                        mainScreenWindow.setScene(mainScreen);
                        mainScreenWindow.show();
                    } else {
                    }
                }
            } catch (IOException e) {
            }
        }
    }
@ FXML private void saveBtnHandler ( ActionEvent event ) throws IOException { String productName = productNameField . getText ( ) ; String productPrice = priceField . getText ( ) ; String productStockLevel = inventoryLevelField . getText ( ) ; String productMinStockLevel = minLevelField . getText ( ) ; String productMaxStockLevel = maxLevelField . getText ( ) ; productFieldException = Product . productFieldExceptions ( productName , productPrice , productStockLevel , productMinStockLevel , productMaxStockLevel , productFieldException ) ; productDataTypeException = Product . prodDataTypeExceptions ( productPrice , productStockLevel , productMinStockLevel , productMaxStockLevel , productDataTypeException ) ; productValueException = Product . productValueExceptions ( Double . parseDouble ( productPrice ) , Integer . parseInt ( productStockLevel ) , Integer . parseInt ( productMinStockLevel ) , Integer . parseInt ( productMaxStockLevel ) , productValueException ) ; if ( productFieldException . length ( ) > 0 ) { System . err . println ( "Empty fields present. Product not added to inventory." ) ; Alert emptyFields = new Alert ( Alert . AlertType . WARNING ) ; emptyFields . setTitle ( "ERROR: EMPTY FIELDS PRESENT" ) ; emptyFields . setHeaderText ( "This product has not been added to inventory" ) ; emptyFields . setContentText ( productFieldException ) ; emptyFields . showAndWait ( ) ; productFieldException = "" ; } else if ( productDataTypeException . length ( ) > 0 ) { System . err . println ( "Invalid data types present. Product not added to inventory." ) ; Alert invalidDataTypes = new Alert ( Alert . AlertType . WARNING ) ; invalidDataTypes . setTitle ( "ERROR: INVALID DATA TYPES PRESENT" ) ; invalidDataTypes . setHeaderText ( "This product has not been added to inventory" ) ; invalidDataTypes . setContentText ( productDataTypeException ) ; invalidDataTypes . showAndWait ( ) ; productDataTypeException = "" ; } else if ( productValueException . length ( ) > 0 ) { System . err . println ( "Invalid field values present. Product has not been added to inventory." ) ; Alert invalidValues = new Alert ( Alert . AlertType . WARNING ) ; invalidValues . setTitle ( "ERROR: INVALID VALUES PRESENT" ) ; invalidValues . setHeaderText ( "This product has not been added to inventory" ) ; invalidValues . setContentText ( productValueException ) ; invalidValues . showAndWait ( ) ; productValueException = "" ; } else { try { if ( associatedParts . isEmpty ( ) ) { System . err . println ( "No parts added to product. Product has not been added to inventory." ) ; Alert noPartsAdded = new Alert ( Alert . AlertType . WARNING ) ; noPartsAdded . setTitle ( "ERROR: NO PARTS ADDED TO PRODUCT" ) ; noPartsAdded . setHeaderText ( "This product has not been added to inventory" ) ; noPartsAdded . setContentText ( "A new product must contain at least one part." ) ; noPartsAdded . showAndWait ( ) ; } else { Product newProduct = new Product ( ) ; newProduct . setId ( productID ) ; newProduct . setName ( productName ) ; newProduct . setPrice ( Double . parseDouble ( productPrice ) ) ; newProduct . setStock ( Integer . parseInt ( productStockLevel ) ) ; newProduct . setMax ( Integer . parseInt ( productMaxStockLevel ) ) ; newProduct . setMin ( Integer . parseInt ( productMinStockLevel ) ) ; newProduct . setAssociatedParts ( associatedParts ) ; Inventory . addProduct ( newProduct ) ; System . out . println ( "Product " + productName + " (ID#: " + productID + ") successfully added to inventory." ) ; Alert productAddSuccess = new Alert ( Alert . AlertType . INFORMATION ) ; productAddSuccess . setTitle ( "SUCCESS: PRODUCT ADDED" ) ; productAddSuccess . setHeaderText ( productName + " Successfully Added to Inventory" ) ; productAddSuccess . setContentText ( "Click OK to return to the main screen." ) ; productAddSuccess . showAndWait ( ) ; if ( productAddSuccess . getResult ( ) == ButtonType . OK ) { System . out . println ( "User confirmed product addition.\nExiting to Main Screen." ) ; Parent root = FXMLLoader . load ( getClass ( ) . getResource ( "/View/MainScreen.fxml" ) ) ; Scene mainScreen = new Scene ( root ) ; Stage mainScreenWindow = ( Stage ) ( ( Node ) event . getSource ( ) ) . getScene ( ) . getWindow ( ) ; mainScreenWindow . setTitle ( "ABC Company: Inventory Management System" ) ; mainScreenWindow . setScene ( mainScreen ) ; mainScreenWindow . show ( ) ; } else { } } } catch ( IOException e ) { } } }
* Save Button Handler verifies that there are no empty fields, incorrect
 values, or incompatible data types present.
* Save Button Handler verifies that there are no empty fields incorrect values or incompatible data types present .