Corrected code:
-------------------BEGIN CODE-------------------
if (minute <= 3.0)
{
price = (1.99 + 2.00);
}
else if (minute > 3.0)
{
price1 = (0.45 * minute);
}
-------------------END CODE-------------------
Get rid of the ; at the end of your if statements:
if (minute <= 3.0); <<- No semicolon here.
My problem basically states that if someone is on a flight 3 minutes or less, it's $2.00 and for every minute after the 3 it's $0.45 per minute. The connection fee which is added on at the beginning is $1.99.
this is what I have under the part I'm having trouble with:
if (minute <= 3.0);
price = (1.99 + 2.00);
if (minute > 3.0);
price1 = (0.45 * minute);
total = price + price1;
but say the user enter's 5 mininutes, the total should be $4.89 but then java says it's 6.24. what is wrong with what I'm doing? I know the rest of the program is right this is the only wrong part. Thank you!