-
Notifications
You must be signed in to change notification settings - Fork 0
Letter Inventory
- Lab 3 - Letter Inventory
- Author: Jamison Schmidt
- Date: 1/23/2024
This lab focused mainly on parsing, storing, and modifying data.
This program takes in user input, parses it, and then allows the user to modify it further. The LetterInventory class is meant to only contain integers, so all non-characters must be removed from the user input. For me, this was a good introduction to Java regex. After a LetterInventory has been instantiated with new data, the user can perform the following actions: add, subtract, set, get, and size.
Adds another LetterInventory to the current LetterInventory.
Removes the characters from another LetterInventory to the current LetterInventory. The minimum value is set to zero because there can be no negative occurrences for each character.
Sets the number of occurrences for a given letter.
Retrieves and returns the number of occurrences for a given letter.
Returns the size of the entire LetterInventory object. To increase the speed of output, the size is saved to a variable instead of calculated by iterating through every letter in the object