Amazon Interview Question
Software Engineer / DevelopersCountry: United States
core objects:
- GPS is a global wrap class which contains below classes
1) MAP
2) current location and destination location (which is a location class)
3) route
4) displayer
methods
- update current location then refresh map and display
- add/change/remove destination location
- mark a route on the map
-....
what the data structure behind MAP??
The satellite s/w can have the following structure:
//CLASSES:
Sensor, GroundCommunication, PositionData, GPS //will be an observable.
//INTERFACES:
ObservablePosition
The
GPS
class will be used by the client s/w to interface with the GPS.
The ground unit will subscribe to receive Inputs from the GPS system.
Ground Unit:
//INTERFACES:
PositionObserver
//CLASSES:
ReceiverModule
// This will be an observer to the position and will attempt a 'pull' for the information
Positions //For persistent storage of position information. May be used for route finding.
Controller //This is just a general class. Ment to be a package rather than just a class.
UserInterface //There may be multiple Interface classes. But for the interviewers sake keep it short.
Feel free to point out any flaws / enhancements. :-D
Good Question
- hprem991 February 13, 2013We can have the following approach
class GPS have the following methods
1> getLongitude() which will connect to the network and get the longitude value of it and return the double.
2> Similarly getLatitude() and getaltitude() returning corresponding double values.
3> Similarly we need one more method called getPosition(double longitude,double latitude, double altitute), which will accept these values and calculate the point of intersection as the current position.