Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set fare=5.00 // Set as a constant so that less memory is used.
- Set X=0, Set Y=0, Distance=0, total_Distance=0, Total_distance=0 // All of the floats that are used are here
- Set Direction = NULL(String) // Null is used so less memory is used
- Set Journey_End = false
- While(Journey_End = false)
- Ask user if they want to stop
- if user wants to stop
- Journey_End= True
- ELSE
- Ask Direction
- get Direction
- ask Distance
- get Distance
- if(direction =North)then
- Set Y= Y+distance
- total_Distance= total_Distance+distance
- elseif(direction =South)then
- Y= Y-distance
- total_Distance= total_Distance+distance
- elseif(direction =East)then
- Set X= X+distance
- Set total_Distance= total_Distance+distance
- elseif(direction =West)then
- Set X= X+distance
- Set total_Distance= total_Distance+distance
- 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