Answered step by step
Verified Expert Solution
Link Copied!

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.
CV05
"swilaveka './mintirho_ya_ku nghenisa'."
modula Genre
POP, CLASSIC, JAZZ, ROCK, TIKO =*1..5
makumu
$genre_names =['Null', 'Pop', 'Xikhale', 'Jazz', 'Rock', 'Tiko'].
tlilasi Album
attr_accessor :mutshila, :xihloko, :lebula, :genre, :nhlayo_ya_tinsimu, :tinsimu
def initialize (mutshila, vito, lebula, muxaka, nhlayo_ya_tinsimu, tinsimu)
@mutshila = mutshila
@xihloko = xihloko
@lebula = lebula
@genre = muxaka wa vuyimbeleri
@nhlayo_ya_tinsimu = nhlayo_ya_tinsimu
@tracks = swichayachayana
makumu
makumu
tlilasi Track
attr_accessor :vito, :ndhawu
def initialize (vito, ndhawu).
@vito = vito
@ndhawu = ndhawu
makumu
makumu
#xihlawulekisi xa menyu leyikulu 1
def hlaya_eka_tialbamu
music_file = Fayili.yintshwa(""tialbamu.txt"",""r"")
tialbamu = hlaya_tialbamu(fayili_ya_vuyimbeleri).
fayili_ya_vuyimbeleri.pfala().
puts('Fayili ya alibamu yi layichiwile')
read_string('Cinekela enter ku ya emahlweni')
ku vuyisa tialibamu
makumu
##################################################
# Yi hlaya endzeni yi vuyisa track yin'we ku suka eka fayili leyi nyikiweke
def read_track(fayili_ya_vuyimbeleri).
vito_ra_track = fayili_ya_vuyimbeleri.gets().
track_location = fayili_ya_vuyimbeleri.yi kuma ().
track = Track.new(vito_ra_track, ndhawu_ya_track)
track yo vuyela
makumu
# Yi vuyisa nxaxamelo wa tinsimu leti hlayiweke ku suka eka fayili leyi nyikiweke
def read_tracks(fayili_ya_vuyimbeleri).
track_count = fayili_ya_vuyimbeleri.yi kuma().eka_mina ().
ti track = Array.yintshwa ().
xikombo =0
loko (xikombo < nhlayo_ya_ndlela).
track = read_track(fayili_ya_vuyimbeleri).
ti track << track
xikombo +=1
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 read_album(fayili_ya_vuyimbeleri).
album_artist = fayili_ya_vuyimbeleri.yi kuma ().
album_title = fayili_ya_vuyimbeleri.yi kuma().
album_label = fayili_ya_vuyimbeleri.yi kuma().
album_genre = fayili_ya_vuyimbeleri.yi kuma ().
album_number_of_tracks = fayili_ya_vuyimbeleri.yi kuma().
tracks = hlaya_tinsimu(fayili_ya_vuyimbeleri).
album = Album.new(mutshila_wa_albamu, nhlokomhaka_ya_albamu, lebula_ya_albamu, muxaka_wa_albamu, nhlayo_ya_albamu_ya_tinsimu, tinsimu)
ku vuyela album
makumu
# Ku hlaya eka ti album hinkwato i return albums array
def read_albums(fayili_ya_vuyimbeleri).
album_count = fayili_ya_vuyimbeleri.yi kuma().eka_mina ().
tialibamu = Array.yintshwa ().
xikombo =0
while (xikombo < nhlayo_ya_albamu).
album = hlaya_albamu(fayili_ya_vuyimbeleri).
tialibamu << alibamu
xikombo +=1
makumu
ku vuyisa tialibamu
makumu
##################################################
#xihlawulekisi xa menyu leyikulu 2
def display_albums(tialbamu).
ku herile = mavunwa
sungula
u veka 'Menyu yo kombisa Tialbamu:'.
puts '1 Kombisa Tialbamu Hinkwato'.
u veka '2 Display Albums hi Genre'.
u veka '3 Vuyela eka Menyu-nkulu'.
choice = read_integer_in_range(""Hi kombela u nghenisa nhlawulo wa wena:"", 1,3)
ku hlawula nandzu
loko 1
display_all_albums(tialbamu).
loko 2
kombisa_tialbamu_hi_genre(tialbamu).
loko 3
ku herile = ntiyiso
xin'wana
puts ""Ndzi kombela u hlawula nakambe"".
makumu
ku hela ku kondza ku hela
makumu
#display album menu xihlawulekisi xa 1
def display_all_albums(tialbamu).
xikombo =0
puts(""Ntsengo hinkwawo wa tialibamu: ""+ tialbamu.ku leha.ku ya eka_s)
while (index < tialibamu.ku leha).
print_album (tialbamu [xikombo]).
xikombo +=1
makumu
makumu
#display album menu option 2, hi ku tirhisa ku lavisisa
def nkombiso_tialbamu_hi_genre(tialbamu).
search_genre = read_integer_in_range(""Hlawula Genre: "",1, $mavito_ya_genre.ku leha.ku_ya_1)
xikombo =0
while (index < tialibamu.ku leha).
loko (tialbamu [index].genre.chomp == ku lavisisa_genre.chomp)
print_album (albamu [xikombo])
makumu
xikombo +=1
makumu
makumu
#################################
# U teka album yin'we a yi printa ku ya fika e terminal xikan'we na ti track ta yona hinkwato
def print_album (albamu).
puts('Muyimbeleri wa Alibamu i '+ album.mutshila.ku_ya_)
puts('Nhlokomhaka ya Alibamu i '+ album.title.to_s)
puts('Lebula ya Rhekhodo i '+ album.label.to_s)
puts('Muxaka wa Alibamu i '+ $mavito_ya_muxaka[album.genre.to_i])
puts('Album yi na '+ album.nhlayo_ya_tinsimu.ku_ya_ti + 'tinsimu')
print_tracks(albamu.tinsimu).
makumu
# Ku teka array ya ti track a ti printa ku ya fika eka terminal
def print_tracks(tindlela).
xikombo =0
loko (index < tracks.ku leha).
print_track (ti track [xikombo]).
xikombo +=1
makumu
makumu
# U teka track yin'we a yi printa ku ya fika eka terminal
def print_track (xichayachayana).
puts('Nhlokomhaka ya track i '+ track.name)
puts('Ndhawu ya track i '+ track.location)
makumu
#########################

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

What other publications/presentations does the person have?

Answered: 1 week ago