-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleCash
More file actions
41 lines (40 loc) · 1.02 KB
/
Copy pathSimpleCash
File metadata and controls
41 lines (40 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local money = 0 -- amount of money to start with
function clearPrint(string)
term.clear()
term.setCursorPos(1,1)
print(string)
end
while true do
clearPrint("---------------")
print("-cash register-")
print("---------------")
print("Current balance: "..money.."$.")
print("Type a command: [add, check, remove]")
write("> ")
input = read()
if input == "add" then
clearPrint("----------")
print("-Add Cash-")
print("----------")
write "Add Ammount: "
add = read("$")
money = money + add
print("Your new balance: "..money.."$.")
elseif input == "check" then
clearPrint("---------------")
print("-cash checking-")
print("---------------")
print("You currently have: "..money.."$.")
sleep(2)
elseif input == "remove" then
clearPrint("-------------")
print("-Remove cash-")
print("-------------")
write "Subtract Ammount: "
remove = read("$")
money = money - remove
print("Your new balance: "..money.."$.")
else
print"Wrong input"
end
end