-2

How do i fix this error I keep getting?

(https://i.stack.imgur.com/mTUyf.png)

enter image description here

I am trying to split up the code into each line rather than all in one minimum temperature maximum temperature average temperature skew of the temperature values range of the temperature values

want each on their own please refer to pic

enter image description here

code:

import java.util.Scanner;
public class TemperatureStats {
  public static void main(String[] args) {
    // declare and instantiate a Scanner 
    Scanner scanner = new Scanner(System.in);

    // declare and initialize variables
    

    // prompt for and collent inputs
        System.out.println("Enter first Temperature: ");
        double temp1 = scanner.nextDouble();
        
        System.out.println("Enter second Temperature: ");
        double temp2 = scanner.nextDouble();

        System.out.println("Enter third Temperature: ");
        double temp3 = scanner.nextDouble();

        System.out.println("Enter fourth Temperature: ");
        double temp4 = scanner.nextDouble();
        
        double minTemp = Math.min(Math.min(temp1, temp2), Math.min(temp3, temp4));
        
        double maxTemp = Math.max(Math.max(temp1, temp2), Math.max(temp3, temp4));

        double avgTemp = (temp1 + temp2 + temp3 + temp4) / 4.0;
        
        double range = maxTemp - minTemp;
        
        double skew = ((avgTemp - (minTemp + maxTemp) / 2.0) / range) * 100.0;
        
    // compute the required information
        System.out.printf("Min: %.1f\n", minTemp);
       
        System.out.printf("Max: %.1f\n", maxTemp);
        
        System.out.printf("Average: %.1f\n", avgTemp);
        
        System.out.printf("Skew: %.1f%%\n", skew);
        
        System.out.printf("Range: %.1f\n", range);
        
        

    // output the require results
       scanner.close();
  }
}

0 Answers0