BONUS = 0.15 # Author: James Tam # Version: November 7, 2013 # On a line-by-line basis the program reads from a file called "employees.txt". # Each line is separated into the three fields: name, occupation, income. # Because it's a good year each employee gets a bonus of 15% to his/her income. inputFile = open ("employees.txt", "r") print ("Reading from file input.txt") # While we haven't read past the end of the file continue reading from # it. for line in inputFile: name,job,income = line.split(',') last,first = name.split() income = int(income) income = income + (income * BONUS) print("Name: %s, %s\t\t\tJob: %s\t\tIncome $%.2f" %(first,last,job,income)) # Finished writing to file, provide feedback to user and close file. print ("Completed reading of file input.txt") inputFile.close()