Hello,
I have a programming assignment ive spent the better part of today working and I am having some trouble. I have to make a program that reads data from a text document containing employee information. After the information on the file is read the hours variable has to be added up. I cannot figure out how to get the hours to add up though. This is what I have so far.
This whileloop reads all the data in the text document and and prints it out on the screen. But when I try to add a totalHours variable inside the loop it prints out on every iteration of the loop. When I try to add a totalHours variable outside the loop it says the hours variable has not yet been declared. So how would I get the program to add up all the hours then print the total only once? Please help!