-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay-2
21 lines (17 loc) · 769 Bytes
/
Day-2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
public class Solution {
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
scan.close();
// Write your calculation code here.
double tip = mealCost * tipPercent / 100;
double tax = mealCost * taxPercent / 100;
// 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.");
}
}