Advertisement
Guest User

Thing

a guest
Oct 4th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Set fare=5.00 // Set as a constant so that less memory is used.
  2. Set X=0, Set Y=0, Distance=0, total_Distance=0, Total_distance=0 // All of the floats that are used are here
  3. Set Direction = NULL(String) // Null is used so less memory is used
  4. Set Journey_End = false
  5.  
  6. While(Journey_End = false)
  7. Ask user if they want to stop
  8. if user wants to stop
  9. Journey_End= True
  10. ELSE
  11. Ask Direction
  12. get Direction
  13. ask Distance
  14. get Distance
  15. if(direction =North)then
  16. Set Y= Y+distance
  17. total_Distance= total_Distance+distance
  18. elseif(direction =South)then
  19. Y= Y-distance
  20. total_Distance= total_Distance+distance
  21. elseif(direction =East)then
  22. Set X= X+distance
  23. Set total_Distance= total_Distance+distance
  24. elseif(direction =West)then
  25. Set X= X+distance
  26. Set total_Distance= total_Distance+distance
  27.  
  28. Print Grid Coordinates = X AND Y, Total distance = total_Distance, Price = ((total_Distance/0.25)*2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement