Song Management Example
This example shows a run of the program that tests input validation / bad user input. User input shown in bold.
$ python3 songs.py
--CS 21 Song Management System--
1) Load songs from file
2) Display individual song details
3) Display all song details
4) Add song
5) Build playlist
0) Quit
What would you like to do? 2
Which song ID? -1
Please enter an integer larger than 0.
Which song ID? 0
Please enter an integer larger than 0.
Which song ID? 15
No matching song found.
--CS 21 Song Management System--
1) Load songs from file
2) Display individual song details
3) Display all song details
4) Add song
5) Build playlist
0) Quit
What would you like to do? 4
Song ID: 0
Please enter an integer larger than 0.
Song ID: 1
Sorry, song ID 1 is already in use.
Song ID: 2
Sorry, song ID 2 is already in use.
Song ID: 9
Sorry, song ID 9 is already in use.
Song ID: 100
Artist: Test
Title: Test song
Duration (in seconds): 0
Please enter an integer larger than 0.
Duration (in seconds): -100
Please enter an integer larger than 0.
Duration (in seconds): 2
--CS 21 Song Management System--
1) Load songs from file
2) Display individual song details
3) Display all song details
4) Add song
5) Build playlist
0) Quit
What would you like to do? 5
Song #1 ID? 0
Please enter an integer larger than 0.
Song #1 ID? -10
Please enter an integer larger than 0.
Song #1 ID? 15
No matching song found.
Song #1 ID? 1
Song #2 ID? 0
Please enter an integer larger than 0.
Song #2 ID? 100
Song #3 ID? 2
Song #4 ID? 3
Song #5 ID? 4
Final playlist:
1 | Led Zeppelin | Stairway to Heaven | 8:02
100 | Test | Test song | 0:02
2 | Metallica | Master of Puppets | 8:35
3 | Adele | Rolling in the Deep | 3:48
4 | Madonna | Material Girl | 4:00
Total duration: 24:27
--CS 21 Song Management System--
1) Load songs from file
2) Display individual song details
3) Display all song details
4) Add song
5) Build playlist
0) Quit
What would you like to do? -1
Please enter an integer between 0 and 5.
What would you like to do? 6
Please enter an integer between 0 and 5.
What would you like to do? 15
Please enter an integer between 0 and 5.
What would you like to do? 0
Bye!