import java.util.Scanner;
public class MaximumFinder
{
public void determineMaximum()
{
Scanner input = new Scanner ( System.in );
System.out.println("輸入四個數字");
double number1 = input.nextDouble();
double number2 = input.nextDouble();
double number3 = input.nextDouble();
double number4 = input.nextDouble();
double result = maximum ( number1 , number2 , number3 , number4);
System.out.printf("最大數為:" + result);
}
public double maximum( double a , double b , double c , double d )
{
double maximumValue = a ;
if ( b > maximumValue )
maximumValue = b ;
if ( c > maximumValue )
maximumValue = c ;
if ( d > maximumValue )
maximumValue = d ;
return maximumValue;
}
}
留言列表