// Student Name: Pradhith Konduri // School Name: Harmony School of Advancement // ACSL division: Intermediate 5 import java.io.*; import java.util.*; public class DraftPicks { public static void main(String[]args)throws IOException { BufferedReader bf=new BufferedReader(new FileReader("DraftPicks.dat")); double[]a1=new double[10]; double[]a2=new double[10]; double[]a3=new double[10]; ArrayList arry=new ArrayList(); double sum=0; for(int i=0;i<10;i++) { StringTokenizer st=new StringTokenizer(bf.readLine(),","); double numYears=Double.parseDouble(st.nextToken()); a1[i]=numYears; double amount=Double.parseDouble(st.nextToken()); a2[i]=amount; a3[i]=a2[i]/a1[i]; sum+=a3[i]; arry.add(a2[i]/a1[i]); } sum/=10; //sum is now average Arrays.sort(a3); double largestSalary=a3[9];//value of the largest salary int byWhom=0; for(int j=0;j<10;j++) { if(largestSalary==arry.get(j)) byWhom=j+1;//person number with the largest salary } double range=(a3[9]-a3[0])/16.;//difference between highest and lowest salaries per game Arrays.sort(a3); double midrange=(a3[0]+a3[9])/18/2;//average of lowest and higest salaries for 18 game season double avgDif=0; for(int j=0;j<10;j++) avgDif+=a3[j]/16-a3[j]/18; avgDif/=10;//avg dif between salary per game for 16 games and 18 games System.out.println(Math.round(sum*1000000)); System.out.println(Math.round(largestSalary*1000000)+" by #"+byWhom); System.out.println(Math.round(range*1000000)); System.out.println(Math.round(midrange*1000000)); System.out.println(Math.round(avgDif*1000000)); } }