/**
 * This function calculates the density of a substance given its volume and mass.
 *
 * The density of a substance is calculated as the ratio of its mass to its volume.
 *
 * @param volume The volume of the substance in cubic units.
 * @param mass The mass of the substance in grams.
 * @return The density of the substance in grams per cubic unit.
 */
fun calculateDensity(volume: Float, mass: Float): Float {

    var result = 0.0f
    
    // Check if both volume and mass are positive numbers
    if (volume > 0.0f && mass > 0.0f) {
        result = mass / volume
    } else {
        result = -1.0f  // Invalid input values. Assigning an arbitrary negative value.
    }
    
    return result
}
/**
 * This function calculates the density of a substance given its volume and mass.
 *
 * The density of a substance is calculated as the ratio of its mass to its volume.
 *
 * @param volume The volume of the substance in cubic units.
 * @param mass The mass of the substance in grams.
 * @return The density of the substance in grams per cubic unit.
 */
fun calculateDensity(volume: Float, mass: Float): Float {
/**
 * This function calculates the density of a substance given its volume and mass.
 *
 * The density of a substance is calculated as the ratio of its mass to its volume.
 *
 * @param volume The volume of the substance in cubic units.
 * @param mass The mass of the substance in grams.
 * @return The density of the substance in grams per cubic unit.
 */
fun calculateDensity(volume: Float, mass: Float): Float {

    var result = 0.0f
    
    // Check if both volume and mass are positive numbers
    if (volume > 0.0f && mass > 0.0f) {
        result = mass / volume
    } else {
        result = -1.0f  // Invalid input values. Assigning an arbitrary negative value.
    }
    
    return result
}