We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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" );
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all 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 {
}