Introduction

This assignment will give you practise w/user and program interfaces, and choosing/building useful data structures.

You will maintain a flat-file database, allowing users to query, delete a entry, create an entry.

You'll also, for some practise, submit a make file.

The Assignment

Write a command-line utility called cddb to maintain a flat-file database of album information. You will allow the user to view album info, add a new entry, or delete an entry, where each entry is an album w/all of the track information, as follows:

Options, and Descriptions

  • -d - List album
    • Display an enumerated, alphabetical list of artists
    • You will allow the user to choose an artist by entering the number, or to quit by entering a q
    • You will then list all albums, by release date, enumerated
    • Allow the user to choose an album, by #, or return to the menu above (artists) by entering a
    • If an album is entered, list all songs in that album, by track order. Prompt for input to return to the previous (i.e., the album) menu
  • -d - Delete album. Similar to above, display menus allowing a user to choose an album to delete
  • -a - Add album. You'll prompt for artist, album name, release date, and finally the track list. You may assume that they are entered in track order. You'll want to check that the album doesn't already exist before adding it
  • -h - Show usage msg and quit

You may assume that all names are entered exactly. That is, do not worry about inconsistencies in spelling or capitalisation. E.g., Led Zeppelin, LedZeppelin, and led zeppelin are 3 different groups for this assignment.

If no argument is supplied, a bad argument is supplied, or multiple arguments, print a usage message and exit.

File Format

Album information will be stored in a flat file w/the format shown in sample.db:

Led Zeppelin
1979 In Through the Outdoor
-In the Evening
-South Bound Saurez
-Fool in the Rain
-Hot Dog
-Carouselambra
-All My Love
-I'm Gonna Crawl

Led Zeppelin
1969 II
-Whole Lotta Love
-What Is and What Should Never Be
-The Lemon Song
-Thank You
-Heartbreaker
-Living Loving Maid (She's Just a Woman)
-Ramble On
-Moby Dick
-Bring It on Home

Bob Dylan
1966 Blonde on Blonde
-Rainy Day Women #12 & 35
-Pledging My Time
-Visions of Johanna
-One of Us Must Know (Sooner or Later)
-I Want You
-Stuck Inside of Mobile with the Memphis Blues Again
-Leopard-Skin Pill-Box Hat
-Just Like a Woman
-Most Likely You Go Your Way (And I'll Go Mine)
-Temporary Like Achilles
-Absolutely Sweet Marie
-4th Time Around
-Obviously 5 Believers
-Sad Eyed Lady of the Lowlands

To simplify things, the filename (location of the DB) will be stored in an exported environment variable, $CDDB .

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.