Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Exception in thread "main" java.lang.NumberFormatException: For input string: ""
  2. at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
  3. at java.lang.Integer.parseInt(Integer.java:592)
  4. at java.lang.Integer.parseInt(Integer.java:615)
  5. at Simulation.getJob(Simulation.java:12)
  6. at Simulation.main(Simulation.java:58)
  7.  
  8. //all of this is under main.
  9. m = Integer.parseInt( in.nextLine() );
  10. //make sure the file has stuff in it
  11. while(in.hasNext()){
  12. in.useDelimiter("n");
  13. //Create an array of type job to keep track of our number of jobs.
  14. Job[] jobs = new Job[m];
  15.  
  16. line = in.next() + " ";
  17. token = line.split("\s+");
  18.  
  19. for(int i = 1; i < m; i++){
  20. jobs[i] = getJob(in);
  21. System.out.println(jobs[i]);
  22. }
  23. }
  24.  
  25. //getJob function is here:
  26. public static Job getJob(Scanner in){
  27. String[] s = in.nextLine().split(" ");
  28. int a = Integer.parseInt(s[0]);
  29. int d = Integer.parseInt(s[1]);
  30. return new Job(a,d);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement