• + 0 comments
    public static void plusMinus(List<Integer> arr) {
        int quantityPositive = 0;
        int quantityNegative = 0;
        int quantityZero = 0;
        BigDecimal resultPositive = BigDecimal.valueOf(0);
        BigDecimal resultNegative = BigDecimal.valueOf(0);
        BigDecimal resultZero = BigDecimal.valueOf(0);
    
        for(int i = 0; i < arr.size(); i++ ){
            if(arr.get(i) > 0){
                quantityPositive++;
                resultPositive = BigDecimal.valueOf(quantityPositive).divide(BigDecimal.valueOf(arr.size()), 6, RoundingMode.HALF_UP);
            }else if(arr.get(i) < 0){
                quantityNegative++;
                resultNegative = BigDecimal.valueOf(quantityNegative).divide(BigDecimal.valueOf(arr.size()), 6, RoundingMode.HALF_UP);
            }else{
                quantityZero++;
                resultZero = BigDecimal.valueOf(quantityZero).divide(BigDecimal.valueOf(arr.size()), 6, RoundingMode.HALF_UP);
            }
    
    
        }
    
            System.out.println(resultPositive);
            System.out.println(resultNegative);
            System.out.println(resultZero);
    }