APT Bagel Counting

Problem Statement

You are in charge of web-based orders for your neighborhood bagel store, The Bagel Byte. Each evening you must total the orders to be picked up the next day. Some orders are simply for N bagels, but each order of a dozen or more bagels is topped off with an extra bagel, the so-called "baker's dozen". This means, for example, that an order for 25 bagels actually requires 27 bagels to fulfill since there are two extra bagels needed for each dozen in the order. An order for 11 bagels doesn't require any extra since it's for less than a dozen.

Given an array of bagel orders determine the number of bagels needed to fulfill all the orders.

Definition

Class

public class Bagels { public int bagelCount(int[] orders) { // fill in code here } }

Constraints

Examples

  1. 
    orders = {1,3,5,7}
    
    Returns: 16

    No order is for more than a dozen, return the total of all orders.

  2. orders = {11,22,33,44,55}
    
    
    Returns: 175 since 11 + (22+1) +(33+2) + (44+3) + (55+4) = 175