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;
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;
I am designing a project related to online parking system. ParkingSystem is a class and Driver...
Java. Java is a new programming language I am learning, and so far I am a bit troubled about it. Hopefully, I can explain it right. For my assignment, we have to create a class called Student with three private attributes of Name (String), Grade (int), and CName(String). In the driver class, I am suppose to have a total of 3 objects of type Student. Also, the user have to input the data. My problem is that I can get...
How to build Java test class? I am supposed to create both a recipe class, and then a class tester to test the recipe class. Below is what I have for the recipe class, but I have no idea what/or how I am supposed to go about creating the test class. Am I supposed to somehow call the recipe class within the test class? if so, how? Thanks in advance! This is my recipe class: package steppingstone5_recipe; /** * *...
Hey guys I am having trouble getting my table to work with a java GUI if anything can take a look at my code and see where I am going wrong with lines 38-49 it would be greatly appreciated! Under the JTableSortingDemo class is where I am having erorrs in my code! Thanks! :) import java.awt.*; import java.awt.event.*; import java.util.*; import java.util.List; import javax.swing.*; public class JTableSortingDemo extends JFrame{ private JTable table; public JTableSortingDemo(){ super("This is basic sample for your...
Hi so I am currently working on a project for a java class and I am having trouble with a unit testing portion of the lab. This portion wants us to add three additional tests for three valid arguments and one test for an invalid argument. I tried coding it by myself but I am not well versed in unit testing so I am not sure if it is correct or if the invalid unit test will provide the desired...
I am having a problem with my code. Here are the relevant parts. The method priceNow is supposed to take as an input a string in the form "Q1'20" (for example) and calculate the new price knowing that the price of the CPU decreases by 2% every quarter. Here is my class definition code: public class CPUv2 { private String launchDate; public CPUv2() { this.CPUGeneration = 1; this.CPUSeries = "i3"; this.suggestedPrice =...
I need code in java
The Student class:
CODE IN JAVA:
Student.java file:
public class Student {
private String name;
private double gpa;
private int idNumber;
public Student() {
this.name = "";
this.gpa = 0;
this.idNumber = 0;
}
public Student(String name, double gpa, int
idNumber) {
this.name = name;
this.gpa = gpa;
this.idNumber = idNumber;
}
public Student(Student s)...
The current code I have is the following: package uml; public class uml { public static void main(String[] args) { // TODO Auto-generated method stub } } class Account { private String accountID; public Account(String accountID) { this.accountID = accountID; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } @Override public String toString() { return "Account [accountID=" + accountID + "]"; } } class SuppliesAccount extends Account { private...
How can the java code be edited that when someone exits the lot, they receive an exiting timestamp. And also i would need that exit timestamp to be subtracted from the timestamp the driver gets when entering the lot to find out the total amount of time they were in the parking lot. please explain. should only need a couple of lines added. //////////////////////////////ParkingCarInfo.java/////////////////////////////////////////// package test; import java.sql.Timestamp; //Class: ParkingCarInfo public class ParkingCarInfo { private String name; //name private Timestamp...
Hey I am having trouble with this problem in C++: The first race is tomorrow! You are provided a list of race entries in the following form: vector<string> entryList = { "42, Vance Cardoza", "55, Vanessa Pandara", "36, Gaston Carlton", "99, Rich Diesel", "10, Euler Bustamente" }; In your main() function instantiate a Race object. Use a C++ iterator to walk through the entries in the list above, parse out each car number and driver name and add them to...
I am currently using eclipse to write in java.
A snapshot of the output would be greatly appreciated to verify
that the program is indeed working. Thanks in advance for both your
time and effort.
Here is the previous exercise code:
/////////////////////////////////////////////////////Main
/*******************************************
* Week 5 lab - exercise 1 and exercise 2: *
* ArrayList class with search algorithms *
********************************************/
import java.util.*;
/**
* Class to test sequential search, sorted search, and binary search
algorithms
* implemented in...