This commit is contained in:
mollusk 2019-12-19 10:19:37 -07:00
commit 4ff6e01337
3 changed files with 56 additions and 0 deletions

41
src/stockers.nim Normal file
View File

@ -0,0 +1,41 @@
import strutils
import regex
import strformat
when isMainModule:
var acases: float
var aminutes: float
var name: string
var time_tail = "hours"
stdout.write("Name of employee: ")
name = readLine(stdin)
stdout.write("Number of cases: ")
var cases = readLine(stdin)
if re"[^0-9.]" in cases:
echo "I can't do math on words, fucking moron"
quit(1)
else:
acases = cases.parseFloat()
stdout.write("Number of minutes it took: ")
var minutes = readLine(stdin)
if re"[^0-9.]" in minutes:
echo "I can't do math on words, fucking moron"
quit(1)
else:
aminutes = minutes.parseFloat()
if aminutes < 10:
aminutes = aminutes * 60
let cpm: float = acases / aminutes
echo(fmt"{name} can throw: {cpm:2.2f} cases per minute")

BIN
stockers Executable file

Binary file not shown.

15
stockers.nimble Normal file
View File

@ -0,0 +1,15 @@
# Package
version = "0.1.0"
author = "mollusk"
description = "Calculate various numbers about aisle stocking"
license = "ISC"
srcDir = "src"
bin = @["stockers"]
# Dependencies
requires "nim >= 1.0.4"
requires "regex >= 0.13.0"