You are viewing a single comment's thread. Return to all comments →
Java 8
public static void bonAppetit(List bill, int k, int b) { // Write your code here
int totalCost = bill.stream().mapToInt(Integer::intValue).sum(); int splitCharge = (totalCost - bill.get(k)) / 2; if(b - splitCharge > 0){ System.out.println(b - splitCharge); } else{ System.out.println("Bon Appetit"); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Bill Division
You are viewing a single comment's thread. Return to all comments →
Java 8
public static void bonAppetit(List bill, int k, int b) { // Write your code here