Here is the Question:
The international Olympics Committee has asked you to write a program to process the data and determine the medal winners for the pairs figure skating. You will be given the following file:
Pairs.txt
Which contains the data for each pair of skaters. The data consists of each skater’s name, their country and the score from each of eight judges on the technical aspects and on the performance aspects. A typical record would be as follows:
Smith
Jones
Australia
5.0 4.9 5.1 5.2 5.0 5.1 5.2 4.8
4.3 4.7 4.8 4.9 4.6 4.8 4.9 4.5
The final score for each skater is the sum of the average of the two categories of score.
Design a class to hold the above data and the final score. Read the data in from the file and calculate the final score for each pair. Sort the array of objects , and display the results on the screen in order, giving special prominence to the medal winners.
Here is my Class:
This is my main:
This thing is when i print it from the file, it prints the same score for everyone but its different in the file.
This is how its in the file
Smith
Jones
Australia
5.0 4.9 5.1 5.2 5.0 5.1 5.2 4.8
4.3 4.7 4.8 4.9 4.6 4.8 4.9 4.5
i want to print those two lines for every pair of skaters!(there's 10 pairs) but its not working!
PLEASE HELP!!!!! Text file is attached!

The international Olympics Committee has asked you to write a program to process the data and determine the medal winners for the pairs figure skating. You will be given the following file:
Pairs.txt
Which contains the data for each pair of skaters. The data consists of each skater’s name, their country and the score from each of eight judges on the technical aspects and on the performance aspects. A typical record would be as follows:
Smith
Jones
Australia
5.0 4.9 5.1 5.2 5.0 5.1 5.2 4.8
4.3 4.7 4.8 4.9 4.6 4.8 4.9 4.5
The final score for each skater is the sum of the average of the two categories of score.
Design a class to hold the above data and the final score. Read the data in from the file and calculate the final score for each pair. Sort the array of objects , and display the results on the screen in order, giving special prominence to the medal winners.
Here is my Class:
Code:
public class Skaters {
private String name1;
private String name2;
private String country;
private double [] arrTech = new double [8];
private double [] arrArt = new double [8];
private double score;
public Skaters (String n1, String n2, String c1, double [] arrT, double [] arrA)
{
this.name1 = n1;
this.name2 = n2;
this.country = c1;
this.arrTech = arrT;
this.arrArt = arrA;
}
public void setName1(String n1)
{
name1 = n1;
}
public void setName2(String n2)
{
name2 = n2;
}
public void setCountry(String c1)
{
country = c1;
}
public void setArrTech (double [] arrT)
{
arrTech = arrT;
}
public void setArrArt(double [] arrA)
{
arrArt = arrA;
}
public String getName1()
{
return name1;
}
public String getName2()
{
return name2;
}
public String getCountry()
{
return country;
}
public double getScore()
{
double sum = 0, avg1, avg2;
for (int r = 0; r < arrTech.length; r++)
sum += arrTech[r];
avg1 = sum/arrTech.length;
sum = 0;
for (int s = 0; s < arrArt.length; s++)
sum += arrArt[s];
avg2 = sum/arrArt.length;
return (avg1 + avg2);
}
}
This is my main:
Code:
import java.io.*;
import java.util.Scanner;
public class testSkaters {
public static void main(String[] args) throws IOException {
Skaters [] arrSkaters = new Skaters [50];
File myFile = new File ("Pairs.txt");
Scanner input = new Scanner (myFile);
int countSkaters = 0;
String name1;
String name2;
String country;
double [] arr1 = new double [8];
double [] arr2 = new double [8];
while (input.hasNext())
{
name1 = input.nextLine();
name2 = input.nextLine();
country = input.nextLine();
for (int i = 0; i < arr1.length; i++)
arr1[i] = input.nextDouble();
for (int j =0; j < arr2.length; j++)
arr2[j] = input.nextDouble();
Skaters s1 = new Skaters (name1, name2, country, arr1, arr2);
arrSkaters[countSkaters] = s1;
countSkaters++;
input.nextLine();
}
for (int t = 0; t < countSkaters; t++)
{
System.out.println("Name 1: " + arrSkaters[t].getName1());
System.out.println("Name 2: " + arrSkaters[t].getName2());
System.out.println("Country: " + arrSkaters[t].getCountry());
printArray(arr1);
}
}
public static void printArray (double [] arr3)
{
for (int r = 0; r < arr3.length;r++)
System.out.print(arr3[r]);
System.out.println("");
}
}
This thing is when i print it from the file, it prints the same score for everyone but its different in the file.
This is how its in the file
Smith
Jones
Australia
5.0 4.9 5.1 5.2 5.0 5.1 5.2 4.8
4.3 4.7 4.8 4.9 4.6 4.8 4.9 4.5
i want to print those two lines for every pair of skaters!(there's 10 pairs) but its not working!

PLEASE HELP!!!!! Text file is attached!
