Question
Create a program that reads a file containing a list of songs and prints the songs to the screen one at a time. After each
-
Create a program that reads a file containing a list of songs and prints the songs to the screen one at a time. After each song is printed, except for the last song, the program asks the user to press enter for more.
After the last song, the program should say that this was the last song and quit. If there were no songs in the file to begin with, the program should say that there are no songs to show and quit.
The program should begin by asking the user for the name of the input file. Each song consists of a title, artist and year, as described in Assignment 1. In the file, each song is given on three consecutive lines, also as described in Assignment 1.
Create this program using the class Song from the first exercise of this assignment. Organize your program into separate files as explained in Section 2.4 of the notes.
Hint: Do this exercise gradually. For example, start with a program that just prints all the songs to the screen. Then make it print the songs one at a time, asking the user for more after each song. Then make the program print the correct message if the file is empty. Then figure out how to make it print the right message after the last song.
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