I have a file which reads
Office 1
3
39 7
39 7
39 6.5
Office 2
2
19 8
19 8
This shows which office it is, the next number down is the number of managers in that office then the number of hours each works followed by what they earn per week
I am trying to create a loop so my java file can read the hours then multiply them by the hourly rate then save it as a double then move onto the next office and do the same so I can use the doubles later on in my program, then the loop will end when it gets to the final office I know how to read from the file I am just struggling to get a loop which can do what I specified above
Any help would be much appreciated thanks so much!
EDIT......
public static void main(String[] args) throws FileNotFoundException
{
Scanner inFile = new Scanner(new FileReader("ExternalData.txt"));
String name;
double employees;
double OfficeRate;
double OfficeHours;
double OfficeRate2;
double OfficeHours2;
double OfficeRate3;
double OfficeHours3;
double OfficeRate4;
double OfficeHours4;
name = inFile.nextLine ();
employees = inFile.nextDouble();
OfficeRate = inFile.nextDouble();
OfficeHours = inFile.nextDouble();
OfficeRate2 = inFile.nextDouble();
OfficeHours2 = inFile.nextDouble();
OfficeRate3 = inFile.nextDouble();
OfficeHours3 = inFile.nextDouble();
OfficeRate4 = inFile.nextDouble();
OfficeHours4 = inFile.nextDouble();
double Employee1 = OfficeRate * OfficeHours;
double Employee2 = OfficeRate2 * OfficeHours2;
double Employee3 = OfficeRate3 * OfficeHours3;
double Employee4 = OfficeRate4 * OfficeHours4;
double weeklypay = Employee1 + Employee2 + Employee3 + Employee4;
Now this works dont get me wrong but it's well to long than it should be surely?