updated to calculate and print temperature