How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Scott Your Own Question

Scott, MIT Graduate
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
Type Your Homework Question Here...
Scott is online now
A new question is answered every 9 seconds

An ITunes entry in music library is a descriptor that

Customer Question

An ITunes entry in music library is a descriptor that summarizes information about the tune that it describes. (It is not the actual tune, which is contained in a large music data file.) For each ITunes entry in your own music library file (which is in XML format, but we won't go there) there are between 20 and 50 fields -- i.e., members. If you were to look at the file on your system, you would find that the fields have names like Genre, Track ID, Name, Artist, Bit Rate, Sample Rate, Track Type, and so on.
We will consider a simplified ITunes class, that stores these ITunes entry objects, with only the following four members for each object:
•Name (the title of the song)
•Artist (the performing musician or group)
•Bit Rate (the number of kilobits per second that the ITunes object streams at or plays at -- higher for better quality, lower for smaller data file size)
•Total Time (the playing time of the ITunes object, represented in milliseconds, i.e., 36500 would stand for 36.5 seconds).
The assignment is to first create a class called ITunes that represents these four items, and provides solid protection for the fields. Then, the client, main(), will instantiate between four or more ITunes objects (some using default constructors and some using parameter-taking constructors), display them immediately, mutate many of their fields, display them again to reflect the changes, and finally reset each object to default values and display them one last time. Also, it should do some explicit accessor and mutator tests. This is described in detail further down.
The Program Spec
Class ITunes Spec
Private class instance members:
•string name - the title of the song. All legal strings should be between 1 and 80 characters.
•string artist - the performing musician or group. All legal strings should be between 1 and 80 characters.
•int bitrate - the number of kilobits per second. A legal value should be between 64 and 705.
•int totalTime - the playing time in milliseconds. A legal value should be between 1 second and 1 hour (expressed in milliseconds)
As stated in the modules, we never want to see a literal in our methods. So the class should have static members to hold values for the limits described above, as well as default values for any field that is constructed using illegal arguments from the client. These are put in the public static section.
Public class static consts:
•MAX_PLAY_TIME = 1000*60*60
•DEFAULT_STRING = " (undefined) "
You should supply all of the following public instance methods:
•Constructors -- one that takes no parameters (sets values to default) and one that takes all four parameters.
•Accessors (get()s) and Mutators (set()s) for each instance member.
•string toString() - a method that returns a string which contains all the information of the ITunes object. This string can be in any format as long as it is understandable and clearly formatted. Two of the many possible formats for such a string for one ITunes object might be:
◦"Janiva Magness, You Were Never Mine, 276 seconds, 128k bits per second"
◦"Title: You Were Never Mine / Artist: Janiva Magness / Playing Time: 4 minutes 36 seconds / Bit Rate: 128k"
•void setDefaults() - a method that can be called either by the client or as a helper method by the constructors. This method will reset all private data to their default values.
•void display() - an output method that sends the string returned by the toString() to the screen. display() can, alternatively, send the data directly to the screen on several lines in a different manner than toString(). It can also call upon toString() but prepend and append extra formatting for the console.
The Foothill main()
main() should instantiate four or more ITunes objects, some of them using the default constructor, some using the constructor that takes parameters. It should immediately display all object. Next, it should mutate one or more members of every object, after which it should display all objects a second time. Then, it should reset all objects to their default values using the appropriate method and display all objects one last time. It does not have to take any input from the user.
Other Testing
After the main section, confirm that your mutators correctly filter out and report bad arguments to the client by placing a couple mutator calls (not all of them) in if statements which print different messages depending on whether the mutator succeeded or failed. Also, demonstrate at least two different accessor calls to show that they work from main().
Submitted: 11 months ago.
Category: Homework
Expert:  Ingo U replied 11 months ago.


I see this is in C++? What development tools/platform do you use?
If available, could you please post, attach or upload all relevant requirements, details, work in progress or any other related file(s)?

And, when is this due?

Ingo U

Related Homework Questions