Thank you for sharing your pseudocode! Here are my suggestions:
In your constructor module, you have misspelled "Location" as "Loctaion". Make sure to correct this spelling error.
In your mutators modules, you are not setting the instance variables latitude and longitude. You should set them as follows:
Public Module SetLatitude(real lat)
Set latitude = lat
End Module
Public Module SetLongitude(real long)
Set longitude = long
End Module
In your accessors modules, you are not returning the latitude and longitude values. You should include a return statement as follows:
Public Real getLatitude()
Display "Device Latitude is: ",
getLatitude()
Return latitude
End Module
Public Real getLongitude()
Display "Device Longitude is: ",
getLongitude()
Return longitude
End Module
In your main module, you should call the constructor module to initialize the latitude and longitude values before calling the mobileApp_LocationShift module. You can do this as follows:
//Create a new instance of the App class
App myApp = new App()
//Call the Location constructor to set the initial latitude and longitude values
myApp.Location(0.0, 0.0)
//Call the mobileApp_LocationShift module to get the updated latitude and longitude values
mobileApp_LocationShift()
//Check if the location has shifted and write to file if necessary
If (mobileApp_LocationShift == true)
Open file
File write(getLatitude, getLongitude)
End if
In your mobileApp_LocationShift module, you are not actually updating the latitude and longitude values. You can update them as follows:
Module mobileApp_LocationShift()
SetLatitude(new_latitude_value)
SetLongitude(new_longitude_value)
End Module
Finally, you should add error handling to your code in case the file cannot be opened or written to. You can use try-catch blocks to handle these errors.
I hope these suggestions are helpful!