import java.io.*;
import java.util.*;
import java.lang.*;
public class Assignment10
{
public static double lowestScore = Double.MAX_VALUE;
public static double highestScore = Double.MIN_VALUE;
static String[] names = new String[9];
public static void getName() throws FileNotFoundException
{
Scanner inFile = new Scanner(new FileReader("data.txt"));
for(int i = 0; i < names.length; i++)
{
names[i] = inFile.next() + " " + inFile.next();
inFile.nextLine();
}
System.out.print(Arrays.toString(names));
}
public static void getScore() throws FileNotFoundException
{
Scanner inFile = new Scanner(new FileReader("diving_data.txt"));
double[] scores = new double[72];
Double total = 0.00;
Double Sum1, Sum2, Sum3, Sum4, Sum5, Sum6, Sum7, Sum8, Sum9;
int index = 0;
while(inFile.hasNext()) {
if(inFile.hasNextDouble()) {
scores[index++] = inFile.nextDouble();
}
else {
inFile.next();
}
}
Sum1 = scores[0] + scores[1] + scores[4] + scores[5] + scores[6] + scores[7];
Sum2 = scores[8] + scores[9] + scores[11] + scores[12] + scores[13] + scores[14];
Sum3 = scores[16] + scores[17] + scores[20] + scores[21] + scores[22] + scores[23];
Sum4 = scores[24] + scores[25] + scores[26] + scores[28] + scores[29] + scores[30];
Sum5 = scores[32] + scores[33] + scores[35] + scores[36] + scores[37] + scores[38];
Sum6 = scores[40] + scores[41] + scores[42] + scores[43] + scores[45] + scores[46];
Sum7 = scores[48] + scores[49] + scores[52] + scores[53] + scores[54] + scores[55];
Sum8 = scores[56] + scores[58] + scores[59] + scores[60] + scores[61] + scores[62];
Sum9 = scores[66] + scores[67] + scores[68] + scores[69] + scores[70] + scores[71];
System.out.println(Sum1); // test
}
public static void main(String[] args) throws FileNotFoundException
{
getScore();
getName();
}
}
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE