#!/usr/bin/env bash
echo ""
printf "Anzahl Stück Seife: "; read a
printf "Gewicht in Gramm pro Stück: ";read b
printf "Anzahl Leute, die sich die Hände waschen: ";read c
#Berechnungsfoo
d=$[a*b]
#echo $d
e=$[1*c]
#echo $e
f=$[d/e]
echo "----------------------------------------------------------------------------------"
echo "Bei" $a "Stück Seife à" $b "Gramm können sich" $c "Personen davon etwa" $f "Tage lang die Flossen waschen."
#unnützer fooiger foo zum foo machen
rest=$a
preis=0
# 48er Packs
packs48=$((rest / 48))
preis=$((preis + packs48 * 19999))
rest=$((rest % 48))
# 4er Packs
packs4=$((rest / 4))
preis=$((preis + packs4 * 2499))
rest=$((rest % 4))
# 2er Packs
packs2=$((rest / 2))
preis=$((preis + packs2 * 1299))
rest=$((rest % 2))
# Einzelstücke
preis=$((preis + rest * 999))
# Ausgabe in Euro (mit Nachkommastellen)
euros=$((preis / 100))
cents=$((preis % 100))
echo "----------------------------------------------------------------------------------"
printf "Als Aleppo-Seife (optimale Staffelpreise) wären das %d,%02d € Warenwert.\n" "$euros" "$cents"
printf "Optimale Staffelpreise sind wie folgt:\n"
printf "1 Stück = 9,99\n2 Stück = 12,99\n4 Stück = 24,99\n48 Stück = 199,99"