You work at a credit card company and as a value-add they want to start providing alerts to users when their spending in any particular category is higher than usual.
- Compare the total amount paid for the current month, grouped by category with the previous month
- Filter down to the categories for which the user spent at least 50% more this month than last month
- Compose an e-mail message to the user that lists the categories for which spending was unusually high
-
-
-
- private Customer customer;
- private Map<Category, Double> unusualSpends;
- private double totalUnusualAmount;
-
-
-
- creditcardexception : contains all defined exceptions for creditCard Validation
- customerexception : contains all defined exceptions for customer Data Validation
- transactionexceptin : contains all defined exceptions for transaction Data Validation
-
-
-
- private final int id;
- private final String name;
- private final String email;
- private CreditCard creditCard;
-
- Smart Constructor
- getters and setters
-
-
-
- private creditcardId : int
- private List transactions
-
- Smart Constructor
- addTransaction
- getters and setters
-
-
-
- private final int transactionId;
- private final LocalDate date;
- private final double amount;
- private final Category category;
-
- Smart Constructor
- Transaction Validations
- getters and setters
-
-
-
- public static double getTotalAmountSpent()
- public static List currentMonthTransactions(List transactions)
- public static List previousMonthTransactions(List transactions)
- public static Map<Category, Double> calculateUnusualSpend(List currentMonthTransactions, List previousMonthTransactions, double thresholdPercentage)
- public static double totalUnusualAmountSpend(Map<Category, Double> unusualSpends)
- public static Map<Category, Double> totalSpending(List transactions)
-
-
-
-
- public String sendEmail(String subject, String body, String customerEmailId)
-
-
-
- public static String generateUnusualSpendingEmail(UnusualSpendingEmailAlertDTO emailDTO)
-
-
-
-
- public Customer createCustomer(int customerId, String customerName, String customerEmail)
- public void createCreditCardForCustomer(int creditCardId, Customer customer)
- public void createTransactionForACreditCard(int transactionId, LocalDate date, double amount, Category category, CreditCard creditCard)
- public boolean analyzeUnusualSpendsFor(CreditCard creditCard)
-