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.
`public static void solve(double meal, int tip, int tax) {
double res1=(tip/100.0)*meal;
double res2=(tax/100.0)*meal; System.out.println(Math.round(res1+res2+meal)); }
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
double meal_cost = Double.parseDouble(bufferedReader.readLine().trim());
int tip_percent = Integer.parseInt(bufferedReader.readLine().trim());
int tax_percent = Integer.parseInt(bufferedReader.readLine().trim());
Result.solve(meal_cost, tip_percent, tax_percent);
bufferedReader.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
JAVA
`public static void solve(double meal, int tip, int tax) { double res1=(tip/100.0)*meal; double res2=(tax/100.0)*meal; System.out.println(Math.round(res1+res2+meal)); } }
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}