Ich erhalte einen unzulässigen Typfehlertest bei der ersten verschachtelten if-Anweisung, nachdem ich ähnliche Fragen untersucht habe, verstehe ich, dass dies normalerweise durch eine fehlplatzierte Klammer verursacht wird. Könnte jemand helfen?Java Unzulässiger Start des Typfehlers
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;
}
}
}
Vielen Dank, mein Herr. – seanysull