i need uml diagram pseudocode and python program for a song
i need uml diagram, pseudocode, and python program for a song class that contains
artist , title , time, and year of the song
song title: Nightmare
song artist: Avenged Sevenfold
song length: 6:14
year released: 2010
Solution
UML Diagram
Song
artist string
title string
time string
year integer
+__init__()
+__str__()
Pseudocode
start program
class song
function __init__ arguments:self,artist,title,time,year
self.artist = artist,self.title = title,self.time= time, self.year = year
function __str__ method arguments: self
return self.artist,self.title,self.time,self.year
end program
Python code:
class song:
def __init__(self,artist , title , time, year):
self.artist = artist
self.title = title
self.time = time
self.year = year
def __str__(self):
return \"Song Title\\t:\\t\"+self.title+\"\ Song Artist\\t:\\t\"+self.artist+\"\ Song Length\\t:\\t\"+self.time+\"\ Year Released\\t:\\t\"+str(self.year)
song1 = song(\"Nightmare\",\"Avenged Sevenfold\",\"6:14\",\"2010\")
print str(song1)
\"\"\"
sample output
Song Title : Avenged Sevenfold
Song Artist : Nightmare
Song Length : 6:14
Year Released : 2010
\"\"\"

