Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am designing a project related to online parking system. ParkingSystem is a cl

ID: 3913976 • Letter: I

Question

I am designing a project related to online parking system. ParkingSystem is a class and Driver is another class. The parking system uses database to fetch the data related to available parking spots. To fetch the parking spots and the distance from drivers location to the parking spot, I need to specify the users current location . I am unable to understand how to code in Java to send the users current location. I have these as my fields in Driver class. How do i add method or is there any import location to send the users location?

public class Driver {

private String custName;

private String LicensePlate;

private int custId;

private int phoneNumber;

private String carMake;

private String carModel;

private int carYear;

private int currentReservation;

public Driver location;

Explanation / Answer

ParkingSystem locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 10, new LocationListener() {

@Override

public void Driver {

@Override

public void custName(String s, int i, Bundle bundle) {}

@Override

public void onProviderEnabled(String s) {}

@Override

public void onProviderDisabled(String s) {}

@Override

public void onLicensePlate (int i) {}

@Override

public void oncustId (int i) {}

@Override

public void onphoneNumber (int i) {}

@Override

public void oncarMake (String s) {}

@Override

public void oncarModel (String s) {}

@Override

public void oncarYear (int i) {}

@Override

public void oncurrentReservation(int i) {}

@Override

public void onDriverLocation(final Location location) {}

});

ParkingSystem myLocation = locationManager.getCurrentLocation(LocationManager.PASSIVE_PROVIDER);

double longitude = myLocation.getLongitude();

double latitude = myLocation.getLatitude();

message+="https://www.google.co.id/maps/@"+latitude+","+longitude;