In Java Parse the attached data and notice any data trends w
In Java: Parse the attached data and notice any data trends while across multiple locations and time.
https://drive.google.com/open?id=0B-rrZhXoU7AaZEd3Ymw1SWY5S3M
If possible with //details.
Thanks.
Solution
package com.chegg;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class chegg {
public static void main(String[] args) throws IOException {
scanner = new Scanner(\"test.txt\");
scanner.useDelimiter(System.getProperty(\"line.separator\"));
while(scanner.hasNext()){
//parse line to get loc Object
Location loc = parsefile(scanner.next());
System.out.println(loc.toString());
}
scanner.close();
//read from system input
System.out.println(\"Read from system input:\");
scanner = new Scanner(System.in);
System.out.println(\"Input first word: \"+scanner.next());
}
private static Location parsefile(String line) {
Scanner scanner = new Scanner(line);
scanner.useDelimiter(\"\\\\s*,\\\\s*\");
String p = scanner.next();
float time = scanner.next();
float data = scanner.next();
float loc = scanner.next();
JavaFileScanner jfs = new JavaFileScanner();
return jfs.new Location(p, time, data,loc);
}
public class Location{
private String person;
private float time;
private float data;
private float location;
public Location(String n, float t, float da,float loc){
this.person = n;
this.time = t;
this.data = da;
this.location = loc;
}
@Override
public String toString(){
return \"person=\"+this.person+\"--->time=\"+this.time+\"--->data=\"+this.data+\"--->location=\"+this.location;
}
}
}

