- #1
yitriana
- 36
- 0
Homework Statement
Create a class that adds counts of letters or two Strings, and create an object which represents sum of the counts.
Homework Equations
n/a
The Attempt at a Solution
i am confused about how to construct objects in a class itself, and not in client code.
as in this site,
http://math.hws.edu/javanotes/c5/s2.html
adding the roll produced by dice is done by client, but not by the class.
further, if objects are instances of the class, then the client must call the class and add whatever it returns or whatever from the methods.
but how can a class do this?
i am instructed to "Constructs and returns a new LetterInventory object that represents the sum of this letter inventory and the other given LetterInventory. The counts for each letter should be added together. The two LetterInventory objects being added together (this and other) should not be changed by this method"