streqicity

calculator 1.2

Apr 30th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. ingredients=1
  2. price=0
  3. folder="butt"
  4. fs.makeDir("butt")
  5. print("do you want to remove, add, or price check an item?")
  6. remove=read()
  7. if remove=="remove" then
  8. print("what item?")
  9. item=read()
  10. fs.delete("butt/"..item)
  11. print("deleted restart in 1 second")
  12. sleep(1)
  13. os.reboot()
  14. elseif remove=="price check" then
  15. bullshit=0
  16. print("when you are done getting prices type exit")
  17. while bullshit==0 do
  18. print("What item are you getting the price for?")
  19. item=read()
  20. if tostring(fs.exists(tostring(folder.."/"..item)))=="true" then
  21. god=fs.open((folder.."/"..item),"r")
  22. print(god.readLine())
  23. elseif item=="exit" then
  24. os.reboot()
  25. else
  26. print("Whoops... I do not appear to have that in our system.")
  27. end
  28. end
  29. else
  30. print("What item are you getting the price for?")
  31. item=read()
  32. print("How many does recipe make:")
  33. quantity=tonumber(read())
  34. while true do
  35.  
  36.  
  37. while ingredients==1 do
  38.  
  39. print("Ingredient(write done when out of ingredients):")
  40. check=read()
  41. if check=="done" then
  42. ingredients=0
  43. cheap=price/2
  44. print("Your Adjusted total is:"..cheap)
  45.  
  46. elseif tostring(fs.exists(tostring(folder.."/"..check)))=="true" then
  47. god=fs.open((folder.."/"..check),"r")
  48. print("How many does it require:")
  49. mult=tonumber(read())
  50. price=price + ((tonumber(god.readLine())*mult)/quantity)
  51. cheap=price/2
  52. print("your total thus far is:",cheap)
  53. elseif tostring(fs.exists(tostring(folder.."/"..check)))=="false" then
  54. god=fs.open((folder.."/"..check),"w")
  55. print("we dont have that item in the system whats the admin price:")
  56. new=tonumber(read())
  57. god.write(new)
  58. print("How many does it require:")
  59. mult=tonumber(read())
  60. price=price+((new*mult)/quantity)
  61. cheap=price/2
  62. print("your total thus far is:",cheap)
  63. end
  64. god.close()
  65. end
  66. if tostring(fs.exists(tostring(folder.."/"..item)))=="false" then
  67. god=fs.open((folder.."/"..item),"w")
  68. god.write(price)
  69. god.close()
  70. print("item saved")
  71. end
  72. print("would you like to do another item y/n:")
  73. if read()=="y" then
  74. os.reboot()
  75. else
  76. os.shutdown()
  77. end
  78. end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment