Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Ruby display a menu that offers the user the following options: 1. Read in Albums 2. Display Albums 3. Select an Album to play

Using Ruby display a menu that offers the user the following options:

1. Read in Albums 2. Display Albums 3. Select an Album to play 5. Exit the application

Menu option 1 should prompt the user to enter a filename of a file that contains the following information: ·The number of albums ·The first artist name ·The first album name ·The release date of the album ·The genre of the album ·The number of tracks ·The name and file location (path) of each track. ·The album information for the remaining albums.

Menu option 2 should allow the user to either display all albums or all albums for a particular genre. The albums should be listed with a unique album number which can be used in Option 3 to select an album to play. The album number should serve the role of a ‘primary key’ for locating an album. But it is allocated internally by your program, not by the user. If the user chooses list by genre - list the available genres.

Menu option 3 should prompt the user to enter the primary key (or album number) for an album as listed using Menu option 2.If the album is found the program should list all the tracks for the album, along with track numbers. The user should then be prompted to enter a track number. If the track number exists, then the system should display the message “Playing track ” then the track name, “ from album ” then the album name. You may or may not call an external program to play the track, but if not the system should delay for several seconds before returning to the main menu.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Ruby class AlbumMenu def initialize albums end def readalbums puts Enter the filename of the album file filename getschomp Fileopenfilename r do file albumscount filereadlinetoi albumscounttimes do ar... 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

Systems Analysis And Design

Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth

7th Edition

1119496489, 978-1119496489

More Books

Students also viewed these Programming questions