# Calculate the Total Cost of Delivered Pizza January 12, 2017

This Clojure code calculates the cost of delivered pizza given:

- the number of pizza eaters
- average number of slices per person
- base price of each pizza

Assumes 8 slices per pie. Rounds up to whole pies. Adds tax @ 6% and a delivery charge @ 10%

```
(defn pizza-cost-calc
"calculate the total cost of delivered pizza for n people"
[n slices-per-person cost-per-pie]
(let [pies (inc (int (/ (* slices-per-person n) 8)))
piecost (* cost-per-pie pies)
tax (* 0.06 piecost)
delivery (* 0.10 piecost)]
(str "total pizza cost for "
n " people: "
"$" (+ piecost tax delivery))))
(pizza-cost-calc 12 3 22.0)
```

For some bizarre reason, deleting this character: ° messes up the editor.