Everything works exactly like its suppose to but when its suppose to show the max and min values out of the 3 numbers, it just returns 0.
//23.4 import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JOptionPane; public class Comparisons extends JApplet { public double sum; public double average; public double product; public double smallest; public double largest; public double minimumValue; public double maximumValue; public void init() { String firstNumber = JOptionPane.showInputDialog( "Enter the first floating-point value" ); String secondNumber = JOptionPane.showInputDialog( "Enter the second floating-point value" ); String thirdNumber = JOptionPane.showInputDialog( "Enter the third floating-point value" ); double number1 = Double.parseDouble( firstNumber ); double number2 = Double.parseDouble( secondNumber ); double number3 = Double.parseDouble( thirdNumber ); sum = number1 + number2 + number3; average = (number1 + number2 + number3) / 3; product = number1 * number2 * number3; } public static double minimum( double number1, double number2, double number3 ) { double minimumValue = number1; if( number2 < minimumValue ) minimumValue = number2; if( number3 < minimumValue ) minimumValue = number3; return minimumValue; } public static double maximum(double number1, double number2, double number3) { double maximumValue = number1; if( number2 > maximumValue ) maximumValue = number2; if( number3 > maximumValue ) maximumValue = number3; return maximumValue; } public void paint(Graphics g) { super.paint(g); g.drawRect(15, 10, 270, 20); g.drawString("The sum is " + sum, 25, 25); g.drawRect(15, 30, 270, 20); g.drawString("The average is: " + average, 25, 45); g.drawRect(15, 50, 270, 20); g.drawString("The product is " + product, 25, 63); g.drawRect(15, 70, 270, 20); g.drawString("The smallest value is " + minimumValue, 25, 83); g.drawRect(15, 90, 270, 20); g.drawString("The largest value is " + maximumValue, 25, 103); } }