else if循环为什么进不去(else if 这里)

else if循环为什么进不去(else if 这里)

package day0;

import java.util.Scanner;

public class day1 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("请输入时间");

Double h = sc.nextDouble();

System.out.println("请输入距离");

Double g = sc.nextDouble();

if (h >= 6.00 && h <= 21.00) {

if (g <= 2) {

System.out.println("本次打车费用7元");

}

if (g > 2) {

double g1 = (g - 2) * 1.5 + 1 + 6;

System.out.println("本次打车费用" + g1 + "元");

} else if (h <= 5.00 | h >= 22.00) {

if (g <= 2) {

System.out.println("本次打车费用7元");

}if (g > 2) {

double g1 = (g - 2) * 1.5 + 1 + 7;

System.out.println("本次打车费用" + g1 + "元");

}

}

}

}

}

收起

🔮 相关作品

世界杯又来了!大家还记得4年前的“乌贼刘”吗?
365bet平台规则

世界杯又来了!大家还记得4年前的“乌贼刘”吗?

📅 10-08 👁️‍🗨️ 9325
windows11怎么关闭微软杀毒
365bet平台规则

windows11怎么关闭微软杀毒

📅 11-10 👁️‍🗨️ 5238
用户增长策略:让你的用户数量、活跃度和忠诚度飙升的秘诀
365bet平台规则

用户增长策略:让你的用户数量、活跃度和忠诚度飙升的秘诀

📅 01-22 👁️‍🗨️ 1125