class JobDetailFormatter {

    protected static BigDecimal estimateCost(int numInstances, BigDecimal costPerHour, long time) {
        BigDecimal cost = BigDecimal.ZERO;
        // calculate the number of machines and the expected run time
        BigDecimal hours = new BigDecimal(Math.max(1, Math.ceil(time / HOURS)));
        cost = cost.add(costPerHour.multiply(new BigDecimal(numInstances)).multiply(hours));
        // dynamoDB costs about 1.5 times the instance cost
        cost = cost.add(cost.multiply(new BigDecimal(1.5D)));
        return cost;
    }

}