Guest User

cokzi

a guest
Jul 21st, 2014
929
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class PPParse {
  5. public static void main (String [] args) {
  6. try{
  7. File f = new File("scores.txt");
  8. Scanner s = new Scanner(f);
  9. int count = 0;
  10. double ppmult = 1.0;
  11. double totalpp = 0;
  12. while(s.hasNext() == true){
  13. if(count%3 == 1){
  14. String s1 = s.nextLine();
  15. s1=s1.substring(0, s1.indexOf(' '));
  16. double pp = Double.parseDouble(s1);
  17. totalpp += pp*ppmult;
  18. ppmult = ppmult*0.95;
  19. }
  20. else { s.nextLine(); }
  21. count++;
  22. }
  23.  
  24. System.out.println(totalpp);
  25. }
  26. catch(FileNotFoundException e) {}
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment