** **
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost.
Here is my code
public class Solution3 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double mealCost = scan.nextDouble(); // original meal price
int tipPercent = scan.nextInt(); // tip percentage
int taxPercent = scan.nextInt(); // tax percentage
double tip = mealCost *(tipPercent/100);
double tax = mealCost*(taxPercent/100);
double total= mealCost+tip+tax;
// cast the result of the rounding operation to an int and save it as totalCost
int totalCost = (int) Math.round(total);
System.out.println("The total meal cost is "+totalCost+" dollars");
}
}
Expected Output
The total meal cost is 15 dollars.
My Output
The total meal cost is 12 dollars.
Please help me out.
Any help would be appreciated.