I have a piece of coursework that I am working on, I have to take in certain inputs from a text file which describe employees and the hours they work, i have to display them in an orderly fashion, then work out the total wage cost for each employee per week, then the combined wage cost of all the employees. I have done all of this, but i am stuck at the last bit. At the start of the program the user has to input a 'Recommended amount of wage costs' and i have to take this and output the shop with the highest total wage costs whilst being lower the recommended amount. At the moment i have this as my code :
And this is the text file that has the data:
Unit One
4
32 8
38 6
38 6
16 7
Unit Two
0
Unit Three
2
36 7
36 7
Unit Four
6
32 6.5
32 6.5
36 6.5
36 6.5
38 6.5
38 6.5
Unit Five
4
32 6.5
32 8
32 7
32 8
Unit Six
5
38 7
30 6.5
24 8
24 8
24 8
Unit Seven
0
Unit Eight
1
40 12
Unit Nine
5
24 8
24 6.5
30 6.5
24 7
32 7
--------
My problem is that when i am using my if statement at the end to find out the unit with the highest cost under the recommended i am only getting the last total wage cost. But i cant figure out why, please help.