MCS-177 Project 9: Music Library (Fall 2016)

Start: Thursday 12/1; Due: Friday 12/9, by the beginning of class


Overview

In this project, you will experiment with building your own Python classes. Many of you have music files on your computer and organize them into playlists. You will build classes to represent your music files and playlists to organize them.

You are to do this project with a partner (but exceptions will be granted if you strongly prefer to submit an individual project). If you work with a partner, please only submit one copy of the code with both names and email addresses written in each of the Python files as a comment at the top of the files. Please also write both partners' names and email addresses on the comment box on Moodle. Else, if you submit an individual project, please state that clearly at the top of your Python files as well as the comment box on Moodle.

Warm up Exercises prior to attempting Task 1 (do not submit)

  1. Read Sections 10.2, 10.3, 10.4 p. 330-341.
  2. Do exercises 10.1-10.3, 10.4, 10.5ab p. 338
  3. Do exercise 10.11 p. 340
  4. Do exercises 10.13-10.17 p. 342-343
  5. Do exercises 10.28abc p. 348 and 10.30-10.32 p. 352

Warm up Exercises prior to attempting Task 2 (do not submit)

  1. Read Sections 10.5 p. 349-350.
  2. Do exercises 10.30, 10.32 p.352
  3. Do exercises 10.33, 10.34 p.352. You may use built-in functions such as sort.
  4. Go back to Table 4.2 p. 125. Try Session 4.6 p. 126 on the computer and do Exercise 4.2(a)-(f). Do Exercise 4.7 p. 128.

Specific tasks

  1. Implement the Song class in song.py such that:

  2. Implement the Playlist class in playlist.py such that:

    Hint: You may use the shuffle or randint function within the random module or use other methods to accomplish this task.
  3. Make at least two sample playlists, each with at least 3 songs, by placing appropriate assignment statements in sample.py. (Make sure there are at least 5 unique songs in your examples.)

Submitting your work

You will be submitting your code using Moodle; click on the following link for instructions on submitting code using Moodle. For this project, you will need to submit the following files:

Grading

You will earn one point for each of the following accomplishments:

  1. You have all the instance variables necessary for the Song class.
  2. You have accessor methods for all the specified instance variables in the Song class.
  3. You have mutator methods for all the specified instance variables in the Song class.
  4. The mutator methods in the Song class respond to a blank string by printing an error message and not changing the instance variable.
  5. The Song class provides a special method such that you can convert a Song object into a string, which would automatically be used for printing.
  6. You have all the instance variables necessary for the Playlist class.
  7. You have accessor methods for all the specified instance variables in the Playlist class.
  8. You have mutator methods for all the specified instance variables in the Playlist class.
  9. The name mutator method in the Playlist class responds to a blank string by printing an error message and not changing the instance variable.
  10. The Playlist class provides a special method such that you can convert a Playlist object into a string, which would be automatically used for printing.
  11. The nextSong method returns a Songobject.
  12. The nextSong method returns the correct Song object when the Playlist is set to non-random order.
  13. The nextSong method returns the correct Song object when the Playlist is set to random order.
  14. The nextSong method does not return the same Song object until all Song objects have been returned by the nextSong.
  15. You wrote the correct contract for each accessor method in the Song and Playlist classes.
  16. You wrote the correct contract for each mutator method in the Song and Playlist classes.
  17. You wrote the correct contract for the nextSong method in the Playlist class.
  18. Your code is not unneccessarily complex.
  19. You construct at least 5 Song objects in sample.py.
  20. You construct at least 2 Playlist objects with different names and songs in sample.py.