The ID should be created by concatenating the first and last characters of the description with the first and last characters of the store of the item. If you are using description as the instance variable for the item's description and id as the instance variable for the item's ID then the following line of code will set id to the first character of the description:
id = "" + description.charAt(0);
The "" + at the beginning of the expression is simply concatenating the empty string to the first character of the description. This is necessary because otherwise the characters will be converted to ints and added together rather than the characters being concatenated together to form a String.
Start with the statement above and then add the last character of the description followed by the first and last characters of the store of the item.
Did anyone figure out how to get the ID to work properly so it reads the first and last letter of the description string and the store string?
ReplyDelete-matt mdhoenk4449@winona.edu