Write a recursive method sumOfDigits(int n) that takes a pos…

Write a recursive method sumOfDigits(int n) that takes a positive integer n and returns the sum of its digits. Example:  sumOfDigits(123); // Output: 6 (1 + 2 + 3)sumOfDigits(9876); // Output: 30 (9 + 8 + 7 + 6) Rubric: Recursive Sum of Digits Method (10 points) Criteria Full Marks (2-3 pts) Partial Marks (1-2 pts) No Marks (0 pts) Method Signature (2 pts) Correct signature (int sumOfDigits(int n)). Minor issues in method signature (e.g., incorrect return type). Missing or incorrect signature. Base and Recursive Case (4 pts) Correctly implements base case (n < 10) and recursive step (n % 10 + sumOfDigits(n / 10)). Base case correct, but recursion has minor logic errors. Does not implement recursion correctly or uses loops instead. Correctness of Output (2 pts) Returns the correct sum for any positive integer. Returns correct sum for simple cases but has edge case issues. Incorrect output for most cases. Code Style and Readability (2 pts) Clean code, meaningful variable names, and proper formatting. Some formatting issues or confusing variable names. Code is messy, lacks indentation, or is missing.

Design a class Alert that models an emergency alert with the…

Design a class Alert that models an emergency alert with the following fields: String message int severityLevel (1 to 5, where 5 is most severe) boolean active Implement: A constructor to initialize all fields. A method boolean shouldBroadcast() that returns true if the alert is active and severityLevel ≥ 3. In your main() method: Create an array of 4 Alert objects with test values. Display only the messages of alerts that should be broadcast.    Rubric: Criteria Points Alert class defined correctly with 3 fields (message, severityLevel, active) 2 Constructor correctly initializes all fields 1 shouldBroadcast() method implemented and correct 2 Array of 4 Alert objects created with realistic test values 2 Loop used to print only the broadcast-worthy messages 2 Clean formatting and correct syntax 1