Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ pq A faultless table or diagram is necessary. Please offer a perfect solution at once. CV 0 5 swilaveka ' . / mintirho _
pq A faultless table or diagram is necessary. Please offer a perfect solution at once.
CV
"swilaveka mintirhoyaku nghenisa'."
modula Genre
POP, CLASSIC, JAZZ, ROCK, TIKO
makumu
$genrenames Null 'Pop', 'Xikhale', 'Jazz', 'Rock', 'Tiko'
tlilasi Album
attraccessor :mutshila, :xihloko, :lebula, :genre, :nhlayoyatinsimu, :tinsimu
def initialize mutshila vito, lebula, muxaka, nhlayoyatinsimu, tinsimu
@mutshila mutshila
@xihloko xihloko
@lebula lebula
@genre muxaka wa vuyimbeleri
@nhlayoyatinsimu nhlayoyatinsimu
@tracks swichayachayana
makumu
makumu
tlilasi Track
attraccessor :vito, :ndhawu
def initialize vito ndhawu
@vito vito
@ndhawu ndhawu
makumu
makumu
#xihlawulekisi xa menyu leyikulu
def hlayaekatialbamu
musicfile Fayili.yintshwatialbamutxtr
tialbamu hlayatialbamufayiliyavuyimbeleri
fayiliyavuyimbeleri.pfala
putsFayili ya alibamu yi layichiwile'
readstringCinekela enter ku ya emahlweni'
ku vuyisa tialibamu
makumu
##################################################
# Yi hlaya endzeni yi vuyisa track yin'we ku suka eka fayili leyi nyikiweke
def readtrackfayiliyavuyimbeleri
vitoratrack fayiliyavuyimbeleri.gets
tracklocation fayiliyavuyimbeleri.yi kuma
track Track.newvitoratrack, ndhawuyatrack
track yo vuyela
makumu
# Yi vuyisa nxaxamelo wa tinsimu leti hlayiweke ku suka eka fayili leyi nyikiweke
def readtracksfayiliyavuyimbeleri
trackcount fayiliyavuyimbeleri.yi kumaekamina
ti track Array.yintshwa
xikombo
loko xikombo nhlayoyandlela
track readtrackfayiliyavuyimbeleri
ti track track
xikombo
makumu
ti track to vuyela
makumu
# Yi hlaya yi tlhela yi vuyisa album yin'we ku suka eka fayili leyi nyikiweke, na tinsimu ta yona hinkwato
def readalbumfayiliyavuyimbeleri
albumartist fayiliyavuyimbeleri.yi kuma
albumtitle fayiliyavuyimbeleri.yi kuma
albumlabel fayiliyavuyimbeleri.yi kuma
albumgenre fayiliyavuyimbeleri.yi kuma
albumnumberoftracks fayiliyavuyimbeleri.yi kuma
tracks hlayatinsimufayiliyavuyimbeleri
album Album.newmutshilawaalbamu, nhlokomhakayaalbamu, lebulayaalbamu, muxakawaalbamu, nhlayoyaalbamuyatinsimu, tinsimu
ku vuyela album
makumu
# Ku hlaya eka ti album hinkwato i return albums array
def readalbumsfayiliyavuyimbeleri
albumcount fayiliyavuyimbeleri.yi kumaekamina
tialibamu Array.yintshwa
xikombo
while xikombo nhlayoyaalbamu
album hlayaalbamufayiliyavuyimbeleri
tialibamu alibamu
xikombo
makumu
ku vuyisa tialibamu
makumu
##################################################
#xihlawulekisi xa menyu leyikulu
def displayalbumstialbamu
ku herile mavunwa
sungula
u veka 'Menyu yo kombisa Tialbamu:
puts Kombisa Tialbamu Hinkwato'.
u veka Display Albums hi Genre'.
u veka Vuyela eka Menyunkulu'.
choice readintegerinrangeHi kombela u nghenisa nhlawulo wa wena:"",
ku hlawula nandzu
loko
displayallalbumstialbamu
loko
kombisatialbamuhigenretialbamu
loko
ku herile ntiyiso
xin'wana
puts Ndzi kombela u hlawula nakambe"".
makumu
ku hela ku kondza ku hela
makumu
#display album menu xihlawulekisi xa
def displayallalbumstialbamu
xikombo
putsNtsengo hinkwawo wa tialibamu: tialbamu.ku leha.ku ya ekas
while index tialibamu.ku leha
printalbum tialbamu xikombo
xikombo
makumu
makumu
#display album menu option hi ku tirhisa ku lavisisa
def nkombisotialbamuhigenretialbamu
searchgenre readintegerinrangeHlawula Genre: $mavitoyagenre.ku leha.kuya
xikombo
while index tialibamu.ku leha
loko tialbamu indexgenre.chomp ku lavisisagenre.chomp
printalbum albamu xikombo
makumu
xikombo
makumu
makumu
#################################
# U teka album yin'we a yi printa ku ya fika e terminal xikan'we na ti track ta yona hinkwato
def printalbum albamu
putsMuyimbeleri wa Alibamu i album.mutshila.kuya
putsNhlokomhaka ya Alibamu i album.title.tos
putsLebula ya Rhekhodo i album.label.tos
putsMuxaka wa Alibamu i $mavitoyamuxakaalbumgenre.toi
putsAlbum yi na album.nhlayoyatinsimu.kuyati 'tinsimu'
printtracksalbamutinsimu
makumu
# Ku teka array ya ti track a ti printa ku ya fika eka terminal
def printtrackstindlela
xikombo
loko index tracks.ku leha
printtrack ti track xikombo
xikombo
makumu
makumu
# U teka track yin'we a yi printa ku ya fika eka terminal
def printtrack xichayachayana
putsNhlokomhaka ya track i track.name
putsNdhawu ya track i track.location
makumu
#########################
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