question archive Need full details for below function for same

Need full details for below function for same

Subject:Computer SciencePrice: Bought3

Need full details for below function for same.

 

public static int getTransactions(int userId, int locationId, int netStart, int

netEnd) {

int total = 0;

Double totalAmount = 0.0;

try {

String url = "?

userId="+userId;

URL obj = new URL(url);

HttpURLConnection con = (HttpURLConnection) obj.openConnection();

con.setRequestMethod("GET");

con.setRequestProperty("Accept", "application/json");

int responseCode = con.getResponseCode();

BufferedReader in = new BufferedReader(new

InputStreamReader(con.getInputStream()));

String inputLine;

StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {

response.append(inputLine);

}

in.close();

String result=response.toString();

JSONParser parser=new JSONParser();

JSONObject objeto = (JSONObject)parser.parse(result);

JSONArray data = (JSONArray) objeto.get("data");

String page = objeto.get("data").toString();

int totalPag = Integer.parseInt(objeto.get("total_pages").toString());

for(int j=1; j<=totalPag; j++){

url = "?

userId="+userId+"&page="+j;

obj = new URL(url);

con = (HttpURLConnection) obj.openConnection();

con.setRequestMethod("GET");

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE