编程题:13
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double Open = scanner.nextDouble();
double High = scanner.nextDouble();
double Low = scanner.nextDouble();
double Close = scanner.nextDouble();
String type;
if (Close < Open) {
type = "BW-Solid";
} else if (Close > Open) {
type = "R-Hollow";
} else {
type = "R-Cross";
}
String shadows = "";
boolean hasLower = (Low < Open && Low < Close);
boolean hasUpper = (High > Open && High > Close);
if (hasLower && hasUpper) {
shadows = " with Lower Shadow and Upper Shadow";
} else if (hasLower) {
shadows = " with Lower Shadow";
} else if (hasUpper) {
shadows = " with Upper Shadow";
}
System.out.println(type + shadows);
}
}
浙公网安备 33010602011771号