getting an error here on the second else if.... I don't understand how it's happening whatsoever as the rest of them have no errors and are stated the same way! Would appreciate any input on this.
The error states; error: illegal start of expression
Here is the code;
/**
* @(#)Exercise4.java
*
*
* @author
* @version 1.00 2014/10/20
*/
import java.util.Scanner;
public class Exercise4 {
public static void main(String[] args) {
float unit, cost;
Scanner input = new Scanner(System.in);
System.out.print("Please Enter The Units Used: ");
unit = input.nextFloat();
if (unit <= 99)
{
cost = (unit*0.05);
}
else if (unit > 99 && unit <= 200)
{
cost = ((99*0.05) + (unit*(0.03)));
}
else if (unit > 200 && <= 300)
{
cost = (((99*0.05) + (200*0.03)) + (unit*0.02));
}
else if (unit>300)
{
cost = ((((99*0.05) + (200*0.03)) + (100*0.02)) + (unit*0.01));
}
System.out.println("\nThe Cost Of Your Mobile Phone Bill Is: EUR" + String.format("%.2f",cost));
}
}