Your class should have the following methods:
- A constructor. Given a string, it will construct an inventory (a count) of the alphabetic letters in the given string, ignoring the case of letters and ignoring any non-alphabetic characters.
- Get. Takes a letter, and returns a count of how many of this letter are in the inventory. Letter might be lowercase or uppercase (your method shouldn’t care). If a nonalphabetic character is passed, your method should throw a user-defined exception having a meaningful name.
Set. Takes a letter and a value, and sets the count for the given letter to the given value. The letter might be lowercase or uppercase. If a nonalphabetic character is passed, your method should throw a user-defined exception.
Comments
Leave a comment