''' DS2000 Spring 2023 Sample code from class - working with files & salary data January 17 Test case - total from file 131111.83 + 63698.64 + 111431.15 + 39508.98 + 27228.00 = 372978.6 Suppose the user types in 10000.35 total should be: 373978.95 ''' FILENAME = "boston_salaries.txt" def main(): # Gather data - read in salaries from the file with open(FILENAME, "r") as infile: salary1 = float(infile.readline()) salary2 = float(infile.readline()) salary3 = float(infile.readline()) salary4 = float(infile.readline()) salary5 = float(infile.readline()) # Gather data - ask the user for their salary? # This is one piece we get from the user, not the file. salary6 = float(input("How much do YOU make?\n")) # Computation - what's the total salary budget, and average? total = salary1 + salary2 + salary3 + salary4 + salary5 + salary6 avg = total / 6 # Communication - report to the user # (Note that we're using sep to make the$ appear next to the value. # Not required on homework, just for fun!) print("Total salary budget (from a sample of 6) is $", round(total, 2), sep = "") print("Average salary (from a sample of 6) is $", round(avg, 2), sep = "") main()