You are not logged in.
A couple of students asked the following:
So when checking the note file is in the correct format, do we have to check that the name of the note is valid?
Here's my answer:
The getFrequency method from the Note class (which is called by the Note constructor) will throw an IllegalArgumentException if it can't parse the note and the Note constructor will throw the same exception if the duration is negative.
All you need to do is watch for exceptions that could be thrown when the Note is created. If an exception is thrown, you just ignore that Note (don't add it to the Guitar object), and then continue reading the file.
Offline