Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is needed for a python program Requirements Your song abstraction should include the following: A way to get a description of the song. Example
This is needed for a python program
Requirements Your song abstraction should include the following: A way to get a description of the song. Example Crazy by Gnarls Barkley from the album St. Elsewhere added on 2019-09-01. Runtime is 3:02. Where the items in bold describe a specific song on the playlist (title, artist, album, date added, runtime). These items must always be set for the song (i.e., they cannot be undefined or empty). A way to get the location of the audio file. This returns the pathname and filename for the audio file. This information must be set when the song is created, and cannot be undefined or empty. Ability to update the play count for the song, ie, the number of times this song has been played. A way to get and set a user rating for the song. The description of the song should show like this after it has been played: Crazy by Gnarls Barkley from the album St. Elsewhere added on 2019-09-01. Runtime is 3:02. Last played on 2019-09-16. ... and like this after it has been rated ... Crazy by Gnarls Barkley from the album St. Elsewhere added on 2019-09-01. Runtime is 3:02. Last played on 2019-09-16. User rating is 3/5. A way to play the song (currently this will do nothing more than update the last played date and the play count). Notes: The date added is set when the Song object is created (i.e., passed in as a constructor parameter). However, the last played date is automatically set to the current date when the song is played. Use a Python datetime object as the type for the added and last played dates. The datetime object has strftime and strptime method to convert between strings and datetime values (i.e., strftime formats the datetime object as a string with a given format like "%Y-%m-%d"). It also has a now() method which returns a datetime object for the current date and time. Use internet for more info on how to use Part 1 - Design Work alone or with a partner to identify the attributes and behaviors we want in our model of the Song, based on the requirements above. You need to create a UML class diagram for the model of the song (class name should be Song) in the following format: Class Name Attributes Methods Add the appropriate class name, attributes and methods to the class diagram. Make sure to follow the correct syntax for the contents of each of the sections including visibility modifiers and data types. Follow Python naming conventions for the class name, attribute names (including the private data convention) and method names. Review your UML diagram with your instructor before you start coding to make sure it is complete Submit the UML diagram in PDF format Part 2 - Construction (10 marks), This part is to be done individually. Instructions: Create a new project in PyCharm called Lab 2. Create a new Python file that matches your class name (i.e., song.py for a Song class). Implement your Song class according to your UML class diagram: o Class Name must match o Attribute names and type must match. o Method names, parameter names and type and return type must match. o It must also have a constructor that initializes all the instance variables to valid values. Note that not all instance variables will have corresponding constructor parameters, but they must all be initialized even if it is to value None. o Make sure to use the leading underscore convention for private attributes and methods. o Use the @property and @Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started