My program will not output the right answer if minus/negative doubles are inputted however the program will output the correct positive double. I think this is because I haven't used the Math.abs correctly but I don't know how to fix this.

My code is as follows:

```
public static void main(String[] args) {
double cubed, squared, input1, input2, smallest;
Scanner scan = new Scanner(System.in);
System.out.println("Enter 2 numbers: ");
input1 = scan.nextDouble();
input2 = scan.nextDouble();
cubed = Math.pow(input1, 3);
input2 = Math.abs(input2);
squared = Math.sqrt(input2);
smallest = Math.min(squared, cubed);
DecimalFormat fmt = new DecimalFormat("00.###");
System.out.println(fmt.format(smallest));
}
```