I am wondering if my logic and syntax makes sense with this if else statement? Do all of my if statements make sense when looking at syntax? I am trying to take the first two numbers of rentalDate to determine the month and see which season charge they will get. Thanks!
public double determinePrice () {
double price;
if (rentalDate.substring(0,2) == ("01") || rentalDate.substring(0,2) == ("02"))
{
price = WINTER_CHARGE;
}
else if (rentalDate.substring(0,2) == ("12"))
{
price = WINTER_CHARGE;
}
else if (rentalDate.substring(0,2) == ("03") || rentalDate.substring(0,2) == ("04") || rentalDate.substring(0,2) == ("05"))
{
price = SPRING_CHARGE;
}
else if (rentalDate.substring(0,2) == ("06") || rentalDate.substring(0,2) == ("07") || rentalDate.substring(0,2) == ("08"))
{
price = SUMMER_CHARGE;
}
else
{
price = FALL_CHARGE;
}
return price;
}