import java.util.Scanner;
/*
* 某城市出租車計費問題:
每日06:00-21:00,起步價6元,當日22:00-次日05:00,起步價7元。0~23
起步價包含2公里,超出部分按照每公里1.5元收費。
每次乘車加收1元的燃油附加稅。
輸入打車的時間和距離,計算本次打車的費用。
*/
public class Test12 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int money = 0;
System.out.println("請輸入打車時間:(0~23)");
int time =sc.nextInt();
if (time<0 && time>23) {
System.out.println("時間錯誤");
return;
}
System.out.println("請輸入打車路程:");
double distance = sc.nextDouble();
//每次乘車加收1元的燃油附加稅。
money += 1;
if (time>= 6&&time <= 21) {
money += 6;
}else{
money += 7;
}
if (distance<=2) {
}else {
money +=(distance-2)*1.5;
}
System.out.println("車費"+money+"元");
}
}