سلام
لطف کنید کده زیر و نگاه کنید:
import java.util.Scanner;
public class MainClass {
public static void main(String[] args) {
// create Scanner for input from window command
Scanner input = new Scanner(System.in);
// prompt for and input three floating-point values
System.out.print("Enter three floating point values separated by spaces: ");
double number1 = input.nextDouble();
double number2 = input.nextDouble();
double number3 = input.nextDouble();
// determine the maximum value
double result = maximum(number1, number2, number3);
System.out.println("Maximum is: " + result);
// close Scanner's object
input.close();
}
// maximumValue method
public static double maximum(double x, double y, double z) {
double maximumValue = x;
if (y > maximumValue) {
maximumValue = y;
}
if (z > maximumValue) {
z = maximumValue;
}
return maximumValue;
}
}
دوستان من هرچی که کد و نگاه می کنم متوجه نمیشم که کجا غلط نوشتم. باید درست اجرا بشه. مشکل اینه که متد maximum مقداره درست و بر نمی گردونه. لطف کنید یه راهنمایی کنید. ممنون.