Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class PPParse {
- public static void main (String [] args) {
- try{
- File f = new File("scores.txt");
- Scanner s = new Scanner(f);
- int count = 0;
- double ppmult = 1.0;
- double totalpp = 0;
- while(s.hasNext() == true){
- if(count%3 == 1){
- String s1 = s.nextLine();
- s1=s1.substring(0, s1.indexOf(' '));
- double pp = Double.parseDouble(s1);
- totalpp += pp*ppmult;
- ppmult = ppmult*0.95;
- }
- else { s.nextLine(); }
- count++;
- }
- System.out.println(totalpp);
- }
- catch(FileNotFoundException e) {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment