We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package com.workattech.splitwise;
public class ExpenseService { public static Expense createExpense(ExpenseType expenseType, double amount, User paidBy, List splits, ExpenseMetadata expenseMetadata) { switch (expenseType) { case EXACT: return new ExactExpense(amount, paidBy, splits, expenseMetadata); case PERCENT: for (Split split : splits) { PercentSplit percentSplit = (PercentSplit) split; split.setAmount((amountpercentSplit.getPercent())/100.0); } return new PercentExpense(amount, paidBy, splits, expenseMetadata); case EQUAL: int totalSplits = splits.size(); double splitAmount = ((double) Math.round(amount100/totalSplits))/100.0; for (Split split : splits) {Splitwise split.setAmount(splitAmount); } splits.get(0).setAmount(splitAmount + (amount - splitAmount*totalSplits)); return new EqualExpense(amount, paidBy, splits, expenseMetadata); default: return null; } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
package com.workattech.splitwise;
public class ExpenseService {
public static Expense createExpense(ExpenseType expenseType, double amount, User paidBy, List splits, ExpenseMetadata expenseMetadata) {
switch (expenseType) {
case EXACT:
return new ExactExpense(amount, paidBy, splits, expenseMetadata);
case PERCENT:
for (Split split : splits) {
PercentSplit percentSplit = (PercentSplit) split;
split.setAmount((amountpercentSplit.getPercent())/100.0);
}
return new PercentExpense(amount, paidBy, splits, expenseMetadata);
case EQUAL:
int totalSplits = splits.size();
double splitAmount = ((double) Math.round(amount100/totalSplits))/100.0;
for (Split split : splits) {Splitwise
split.setAmount(splitAmount);
}
splits.get(0).setAmount(splitAmount + (amount - splitAmount*totalSplits));
return new EqualExpense(amount, paidBy, splits, expenseMetadata);
default:
return null;
}
}
}
The text was updated successfully, but these errors were encountered: