I don't know where to begin in writing this method. Any help would be great!
Write a class method for the Card class called parseCard that takes a String and returns
the corresponding card. You can assume that the String contains the name of a card in a
valid format, as if it had been produced by printCard.
In other words, the string will contain a single space between the rank and the word ``of,''
and between the word ``of'' and the suit. If the string does not contain a legal card name, the
method should return a null object.
Re: parsecard method
This isn't really a collections or generics problem (though it might have arisen in connection with a generified pack of cards...). It seems like a String question.
Have a look at the String methods and see what's useful. Basically you want to examine the first character, the next 4 (which should be " of "), the next ? for the suit, and finally the remainder (there shouildn't be any). Return null as soon as you get "bad" I'm input, otherwise construct and return the Card.