Have you learnt about methods? I would move the code for each task into its own method instead of a huge ugly mess in the main method. As to your problem when do you reset max and min temps? The max...