我遇到以下代码的问题。
我需要使附加费变量等于给定特定结果的两个值之一,而我似乎只能将我的附加值等于R_RATE。
我哪里错了?
String booking;
double AddOn, trip, surcharge;
System.out.print("Enter booking type (A, B or C)");
booking=sc.nextLine();
double R_RATE_PERCENT = .5;
double R_RATE = 5.0;
if (booking.equals("A")
{surcharge = S_Rate;
if(booking.equals("B"))
{
addOn = R_RATE;
if (addOn > trip * R_RATE_PERCENT) {
surcharge = trip * R_RATE_PERCENT;}
else if (addOn < trip * R_RATE_PERCENT){
surcharge = R_RATE;}
}
if(booking.equals("C"))
{
addOn = F_RATE;
if (addOn > trip * F_RATE_PERCENT) {
surcharge = trip * F_RATE_PERCENT;}
else if (addOn < trip * F_RATE_PERCENT){
surcharge = F_RATE;}