Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. class StatsVC {
  2. var data = [String : Stats] ()
  3. var current = "" // The current dataset.
  4. var currentdata : Stats?;
  5.  
  6. you should write a function that returns indexes I1 -> I2 for the add command.
  7.  
  8. write a function that sets the current dataset.
  9.  
  10. func parseCommands(input){ // Will be seperated by spaces.
  11. arguments = the input string split by spaces
  12. check for the command (the command is the first arg){
  13. argument is add
  14. Set data of add name to all of the arguments after 1st.
  15. Set the current to this dataset.
  16. break;
  17. argument is current
  18. Set the current to this dataset.
  19. break;
  20. argument is sum
  21. print the sum of the current dataset
  22. break;
  23. //You will need to add the other commands, too.
  24. argument is write
  25. convert data to a string and save.
  26. break;
  27. argument is read
  28. convert data to multiple datasets and set "data" to those sets
  29. argument is help
  30. print the help screen.
  31. break
  32. argument is info
  33. idek what info is supposed to do
  34. break;
  35. not any of the arguments
  36. tell the user that.
  37. }
  38. }
  39.  
  40. func runStats (){
  41. var Input : String?
  42. repeat{ // Main Loop
  43. Input = getLineFromConsole()
  44. if Input != nil && Input != "quit"{ // The input contains a command.
  45. parseCommands(Input!)
  46. }else{
  47. break;
  48. }
  49. }while Input != "quit"
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement