Key Accounts WrapperReading Only
You need to build an analysis tool that identifies key accounts across multiple industries and calculates key metrics for reporting purposes.
For this problem, we define minimum annual revenue thresholds an account must meet to be considered a key account. The annual revenue thresholds are defined by industry:
* Banking: 600,000
* Technology: 800,000
* Retail: 2,000,000
* All others: 500,000
Implementation Requirements
Step 1:
Complete the KeyAccountWrapper
class by adding these properties:
* String industry
- The industry being analyzed
* Set<Id> keyAccountIds
- Set of Account IDs that qualify as key accounts
* Decimal averageKeyAnnualRevenue
- Average annual revenue of key accounts in this industry
Step 2:
Implement the analyzeKeyAccounts
method in the AnnualThresholdCalculator
class that:
* Takes a list of accounts from multiple industries
* Groups accounts by their industry
* For each industry, determines which accounts meet the key account threshold
* Calculates the average annual revenue of the key accounts per industry
* Returns a List of KeyAccountWrapper
instances (one per industry that has key accounts)
Example
Input
Account a1 = new Account(); a1.Id = '001000000000001'; a1.AnnualRevenue = 750000; a1.Industry = 'Technology'; Account a2 = new Account(); a2.Id = '001000000000002'; a2.AnnualRevenue = 900000; a2.Industry = 'Technology'; Account a3 = new Account(); a3.Id = '001000000000003'; a3.AnnualRevenue = 700000; a3.Industry = 'Banking'; List<Account> accounts = new List<Account>{a1, a2, a3}; AnnualThresholdCalculator calc = new AnnualThresholdCalculator(); List<KeyAccountWrapper> results = calc.analyzeKeyAccounts(accounts);
Expected results: (2 wrappers returned in the list):
industry='Technology', keyAccountIds={a2.Id}, averageKeyAnnualRevenue=900000 industry='Banking', keyAccountIds={a3.Id}, averageKeyAnnualRevenue=700000
Notes
- If an industry has no accounts that qualify as key accounts, do not include a wrapper for that industry
- Handle null/empty revenue values appropriately
- Industry matching should be case-sensitive
- Return empty List if no industries have key accounts
- Only calculate average from accounts that actually qualify as key accounts