• + 0 comments

    I have a problem with the editor... my code runs on my eclipse, but the editor keeps returning error.

    import java.util.; import java.math.;

    public class dntt {

    public static void main(String[] args) {
    
    
        Scanner scan = new Scanner(System.in);
        System.out.println( "enter meal cost");
        double mealCost = scan.nextDouble(); // original meal price
    
        System.out.println( "enter tip percent");
        int tipPercent = scan.nextInt(); // tip percentage
    
        System.out.println( "enter tax percent");
        int taxPercent = scan.nextInt(); // tax percentage
    
        scan.close();
    
        // Write your calculation code here.
    
          double tip = (tipPercent * 0.01 * mealCost);
          double tax = (taxPercent * 0.01 * mealCost);
    
    
    
        // cast the result of the rounding operation to an int and save it as totalCost 
        int totalCost = (int) Math.round(mealCost + tip + tax);
    
        // Print your result
          System.out.println( "The total meal cost is " + totalCost + " dollars" );
    
    }
    

    }