最初のネストされたif文で型エラーの不正な開始が発生しました。同様の質問がありましたが、これは通常、間違った中括弧が原因ですが、私は見えません。誰でも助けてくれますか?Java不正な型エラーの開始
public class Journey
{
private int date;
private double time;
private int busNumber;
private int journeyType;
public static double dayCharge;
public static final double maxDayCharge = 3.50;
public static double weekCharge;
public static final double maxWeekCharge = 15;
public static double monthCharge;
public static final double maxMonthCharge = 48;
private int journeyId;
private static int numberOfJourneys;
private double costOfJourney;
public int getDate(){
return date;
}
public Double getTime(){
return time;
}
public int getBusNumber(){
return busNumber;
}
public double journeyCost(journey reqJourney){
if (journeyType = 1){ //this is where the error occurs
if (dayCharge =< 2.50)
{
costOfJourney = 1;
}
else
{
costOfJourney = maxDayCharge-dayCharge;
}
}
else if (journeyType = 2)
{
if (dayCharge =< 1.80)
{
costOfJourney = 1.70;
}
else
{
costOfJourney = maxDayCharge-dayCharge;
}
}
else if (journeyType = 3)
{
if (dayCharge =< 1.60)
{
costOfJourney = 1.90;
}
else
{
costOfJourney = maxDayCharge-dayCharge;
}
}
return costOfJourney;
}
public boolean isInSequence(journey reqJourney){
journey prevJourney = jArray.get(jArray.size()-1);
if (prevJourney.date > reqJourney.date)
{
return false;
}
}
}
多くのありがとうございます。 – seanysull