commit 9b14a82de52a0e68bf2c89372a66e428a5535d1b Author: mollusk Date: Mon Dec 31 07:24:04 2018 -0700 add basic working prototype diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..a4ae607 --- /dev/null +++ b/Project.toml @@ -0,0 +1,6 @@ +authors = ["mollusk "] +name = "BillCalc" +uuid = "40176720-0cca-11e9-2394-e19ce8dd2e58" +version = "0.1.0" + +[deps] diff --git a/src/BillCalc.jl b/src/BillCalc.jl new file mode 100644 index 0000000..e4b5b4e --- /dev/null +++ b/src/BillCalc.jl @@ -0,0 +1,66 @@ +module BillCalc + + using Printf + householdSize = 3::Int64 # the amount of people to divide by + + function splitCost(bill::Float64, peopleAmount::Int64) + total = bill / peopleAmount + return print("$(@sprintf("%.2f", total))\n") + end + + print("Enter Total Cost of Water Bill: ") + waterBill = chomp(readline()) + + waterBill = lstrip(waterBill, ['.', '@', '#', '$', '%', '^', '&', '*', '(', ')', + '-','+', '-', '+', '{', '}', '[', ']', '|', + ':', ';', '<', '>', ',', '?', '/', '!', '~', '`']) + + println(waterBill);exit(0) + if occursin(r"[0-9]","$waterBill") != true + println("Please enter a number.") + exit(1) + end + + waterBill = tryparse(Float64, waterBill) + + print("Enter Total Cost of Gas Bill: ") + gasBill = readline() + + if occursin(r"[0-9]","$gasBill") != true + println("Please enter a number.") + exit(1) + end + + gasBill = tryparse(Float64, gasBill) + + print("Enter Total Cost of Internet Bill: ") + internetBill = readline() + + if occursin(r"[0-9]","$internetBill") != true + println("Please enter a number.") + exit(1) + end + + internetBill = tryparse(Float64, internetBill) + + print("Enter Total Cost of Electric Bill: ") + electricBill = readline() + + if occursin(r"[0-9]","$electricBill") != true + println("Please enter a number.") + exit(1) + end + + electricBill = tryparse(Float64, electricBill) + + println("-----------------------------------") + println("Cost Per Person") + println("-----------------------------------") + + print("Water: ", '$'); splitCost(waterBill, householdSize) + print("Gas: ", '$'); splitCost(gasBill, householdSize) + print("Internet: ", '$'); splitCost(internetBill, householdSize) + print("Electric: ", '$'); splitCost(electricBill, householdSize) + + +end # module