Course CSV to Courses
Up until now we've used public constructors to create instances of our classes.
But there are other patterns for enabling class creation, and this problem explores one.
Specifically, we're going to show how to deserialize a CSV
String into instances of a custom class.
final class named
Course should not provide a public constructor, although you will probably want to create a
Course should provide a class method named
fromCSV which takes a single
String argument and
returns an array of
Course maintains a
department and a
Here's how they are loaded from a CSV
Given the following CSV contents:
CS, 125 IE, 333 MUS, 230
You should return an array containing three
Course instances: the first with
number="125", the second with
Your array should contain the courses in the same order in which they appear in the CSV
fromCSV method should assert that the passed
String is not
null or empty.)
Course should provide getters for the department and number named
To complete this problem you'll want to review our previous work with CSV
Strings, and apply what you now know
about constructing objects. Have fun!