You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public Customer(String fn, String ln, boolean isAlive, List<TransactionItem> items) {
super(fn, ln, isAlive);
this.items = items;
this.estimatedTotal = calculateEstimatedTotal();
}
private double calculateEstimatedTotal() {
double total = 0;
for (TransactionItem item : this.items) {
total += item.getPrice() * 1.1;
}
return total;
}
public double giveTotal(double totalRequest) throws Exception {
if(totalRequest > this.estimatedTotal) {
throw new Exception(String.format("$%.2f is too much, please review the transaction. I was thinking it should be $%.2f.", totalRequest, this.estimatedTotal));